hdf5依赖试图安装netcdf4



我试图通过pip在运行Python 2.7的CentOS 7系统上安装NetCDF4。以下HDF5软件包已经通过yum安装:

[user@host]$ rpm -qa | grep hdf5
hdf5-openmpi-1.8.12-12.el7.x86_64
hdf5-1.8.12-11.el7.x86_64

尽管包已经安装,我仍然遇到这个错误试图安装hdf5:

[user@host]$ pip install -r requirements.txt 
.
.
.
Collecting netCDF4>=1.1.1 (from -r requirements.txt (line 9))
Using cached https://files.pythonhosted.org/packages/79/0d/caa957cc1b42b718ce4b9b3e849e6f7aa99faad2d522d8f2d7a33500fba0/netCDF4-1.5.6.tar.gz
ERROR: Command errored out with exit status 1:
command: /home/ooiui/miniconda2/envs/ooiui279/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cOs19I/netCDF4/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cOs19I/netCDF4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-cOs19I/netCDF4/
Complete output (30 lines):
Package hdf5 was not found in the pkg-config search path.
Perhaps you should add the directory containing `hdf5.pc'
to the PKG_CONFIG_PATH environment variable
No package 'hdf5' found
reading from setup.cfg...

HDF5_DIR environment variable not set, checking some standard locations ..
checking /home/ooiui/miniconda2/envs/ooiui279/include ...
hdf5 headers not found in /home/ooiui/miniconda2/envs/ooiui279/include
checking /home/ooiui/miniconda2/envs/ooiui279/Library/include ...
hdf5 headers not found in /home/ooiui/miniconda2/envs/ooiui279/Library/include
checking /home/ooiui/include ...
hdf5 headers not found in /home/ooiui/include
checking /usr/local/include ...
hdf5 headers not found in /usr/local/include
checking /sw/include ...
hdf5 headers not found in /sw/include
checking /opt/include ...
hdf5 headers not found in /opt/include
checking /opt/local/include ...
hdf5 headers not found in /opt/local/include
checking /usr/include ...
hdf5 headers not found in /usr/include
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-cOs19I/netCDF4/setup.py", line 425, in <module>
_populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs)
File "/tmp/pip-install-cOs19I/netCDF4/setup.py", line 366, in _populate_hdf5_info
raise ValueError('did not find HDF5 headers')
ValueError: did not find HDF5 headers
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

过去,当我在CentOS 6上安装NetCDF4时,我不需要做任何特殊的调整。有什么变化需要额外的准备吗?提前谢谢。

多亏了phd,我安装了HDF5头文件,并将HDF5_DIR环境变量设置为/include以反映安装位置。现在我似乎遇到了NetCDF4本身的类似障碍:

Collecting netCDF4>=1.1.1 (from -r requirements.txt (line 9))
Using cached https://files.pythonhosted.org/packages/79/0d/caa957cc1b42b718ce4b9b3e849e6f7aa99faad2d522d8f2d7a33500fba0/netCDF4-1.5.6.tar.gz
ERROR: Command errored out with exit status 1:
command: /home/ooiui/miniconda2/envs/ooiui279/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l853Xs/netCDF4/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l853Xs/netCDF4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-l853Xs/netCDF4/
Complete output (23 lines):
Package hdf5 was not found in the pkg-config search path.
Perhaps you should add the directory containing `hdf5.pc'
to the PKG_CONFIG_PATH environment variable
No package 'hdf5' found
reading from setup.cfg...
checking /usr/include ...
HDF5 library version: 1.8.12 headers found in /usr/include
HDF5 library version: 1.8.12 found in /usr

NETCDF4_DIR environment variable not set, checking standard locations..
checking /home/ooiui/miniconda2/envs/ooiui279 ...
checking /home/ooiui/miniconda2/envs/ooiui279/Library ...
checking /home/ooiui ...
checking /usr/local ...
checking /sw ...
checking /opt ...
checking /opt/local ...
checking /usr ...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-l853Xs/netCDF4/setup.py", line 441, in <module>
raise ValueError('did not find netCDF version 4 headers')
ValueError: did not find netCDF version 4 headers
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我们正试图通过pip安装NetCDF4每个requirements.txt文件,但它似乎是失败的缺失NetCDF4头。

ValueError: did not find HDF5 headers

这个错误意味着没有开发文件。您有库,但没有头文件。安装:

yum install hdf5-devel

开发安装值得一试。ubuntu的,我有相同的HDF5_DIR错误,下面解决

sudo apt-get install libnetcdf-dev

最新更新