1

I am getting this strange to me error when installing Keras on an Ubuntu server:

Cythonizing /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/utils.pyx
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1804:0,
                 from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/api_compat.h:26,
                 from /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/defs.c:287:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^
In file included from /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/defs.c:287:0:
/tmp/easy_install-qQggXs/h5py-2.5.0/h5py/api_compat.h:27:18: fatal error: hdf5.h: No such file or directory
 #include "hdf5.h"
                  ^
compilation terminated.
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Any ideas how to fix this issue?

I've downloaded Keras repository from https://github.com/fchollet/keras, and used this command to install it:

sudo python setup.py install

My Linux specifications are:

  • Distributor ID: Ubuntu
  • Description: Ubuntu 14.04.2 LTS
  • Release: 14.04
  • Codename: trusty
4

2 回答 2

2

你需要安装hdf5包来获取你需要的头文件。

于 2015-05-01T10:59:08.237 回答
2

真正的错误是:

“在 /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/defs.c:287:0 中包含的文件中:/tmp/easy_install-qQggXs/h5py-2.5.0/h5py/api_compat.h:27:18 : 致命错误: hdf5.h: 没有这样的文件或目录#include "hdf5.h" "

此错误表示缺少头文件 hdf5.h。

运行以下命令安装头文件:

sudo apt-get install libhdf5-dev

请注意,要安装 h5py 包,请运行以下命令:

sudo pip install h5py

希望这能解决你的问题

于 2017-02-22T22:53:30.930 回答