Подтвердить что ты не робот

Установка h5py на сервере Ubuntu

Я устанавливал h5py на сервере Ubuntu. Однако, похоже, она возвращает ошибку, которая не найдена h5py.h. Он дает то же сообщение об ошибке, когда я устанавливаю его с помощью файла pip или setup.py. Что мне здесь не хватает?

У меня есть версия 1.1.1 для Numpy, которая выше требуемой версии 1.6 или выше.

Полный вывод выглядит следующим образом:

[email protected]:~/h5py-2.3.1⟫ sudo python setup.py install
libhdf5.so: cannot open shared object file: No such file or directory
HDF5 autodetection failed; building for 1.8.4+
running install
running bdist_egg
running egg_info
writing h5py.egg-info/PKG-INFO
writing top-level names to h5py.egg-info/top_level.txt
writing dependency_links to h5py.egg-info/dependency_links.txt
reading manifest file 'h5py.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.c' under directory 'win_include'
warning: no files found matching '*.h' under directory 'win_include'
writing manifest file 'h5py.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/h5py
copying h5py/ipy_completer.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/__init__.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/version.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/highlevel.py -> build/lib.linux-x86_64-2.7/h5py
creating build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/group.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/files.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/selections.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/__init__.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/filters.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/base.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/dims.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/datatype.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/dataset.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/selections2.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/attrs.py -> build/lib.linux-x86_64-2.7/h5py/_hl
creating build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_selections.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_group.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_h5.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_attrs.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_objects.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_slicing.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_h5t.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_datatype.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/__init__.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_dimension_scales.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_base.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_dataset.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_file.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_h5p.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_attrs_data.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/common.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_h5f.py -> build/lib.linux-x86_64-2.7/h5py/tests
running build_ext
skipping 'h5py/defs.c' Cython extension (up-to-date)
building 'h5py.defs' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/h5py
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DH5_USE_16_API -I/home/govinda/h5py-2.3.1/lzf -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c h5py/defs.c -o build/temp.linux-x86_64-2.7/h5py/defs.o
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from h5py/api_compat.h:26,
                 from h5py/defs.c:342:
/usr/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 h5py/defs.c:342:0:
h5py/api_compat.h:27:18: fatal error: hdf5.h: No such file or directory
 #include "hdf5.h"
                  ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
4b9b3361

Ответ 1

Вам нужно установить libhdf5-dev, чтобы получить требуемые файлы заголовков. Просто запустите

sudo apt-get install libhdf5-dev

и он должен автоматически установить его и его зависимости.

Не беспокойтесь о предупреждении NumPy, это просто означает, что разработчики пакетов используют старую версию API, но все будет работать.

Ответ 2

Вы можете использовать python-h5py.

sudo apt-get install python-h5py

И затем в файле Python попробуйте:

import h5py

Ответ 3

В моем случае (Ubuntu 15.04) установка libhdf5-dev была недостаточной.

Мне нужно было запустить:

HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ pip install h5py

чтобы он работал.

Ответ 4

Обычно рекомендуется использовать pip вместо его установки вручную, так как pip также будет устанавливать все зависимости python. Однако вам все равно нужны ваши файлы заголовков.

так:

sudo apt-get install libhdf5-dev
pip install h5py