问题
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
回答1:
You need to install the hdf5 package to get the headers you need.
回答2:
Real Error is :
"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" "
This error says that header file hdf5.h is missing.
Run the following command to install header file:
sudo apt-get install libhdf5-dev
Please note that to install h5py package, run following command :
sudo pip install h5py
Hope this solves your problem
来源:https://stackoverflow.com/questions/29985453/linux-error-when-installing-keras