pytables installation failed

社会主义新天地 提交于 2020-12-31 04:34:31

问题


I do:

sudo pip install --upgrade tables

I get:

    /usr/bin/ld: cannot find -lhdf5
collect2: ld returned 1 exit status
.. ERROR:: Could not find a local HDF5 installation.
   You may need to explicitly state where your local HDF5 headers and
   library can be found by setting the ``HDF5_DIR`` environment
   variable or by using the ``--hdf5`` command-line option.
Complete output from command python setup.py egg_info:
/usr/bin/ld: cannot find -lhdf5

however:

$ echo $HDF5_DIR 
/opt/hdf5/
$ ls /opt/hdf5/
bin  include  lib  share
$ ls /opt/hdf5/lib/
libhdf5.a     libhdf5_hl.la  libhdf5_hl.so.8      libhdf5.la        libhdf5.so libhdf5.so.8.0.1
libhdf5_hl.a  libhdf5_hl.so  libhdf5_hl.so.8.0.1  libhdf5.settings  libhdf5.so.8

What's wrong? How to debug? I already tried to set HDF5_DIR to /opt/ or to /opt/hdf5/lib.


回答1:


I also had the same error on Debian sid trying to work in a local virtualenv. To work around it I did:

apt-get build-dep python-tables
HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ && pip install tables

... now it's working.




回答2:


I'm having a similar problem, but I'm using the leading edge not the pip release (see Aside). I also tried pointing to the library itself

export HDF5_DIR=/usr/lib/libhdf5.so.6

but it did not work.

Aside: You can try the leading edge of PyTables if you think your bug may have been addressed recently:

sudo pip install git+https://github.com/PyTables/PyTables

.

The build (that was caused by pip install...) seemed to progress further after I installed the dev version of the hdf5 library (libhdf5-openmpi-dev). The build still failed for other reasons, but it's another direction you could try.




回答3:


I was able to fix this easily in OSX with virtual environments using the following code:

    $ brew install hdf5
    $ pyvenv test
    $ workon myvenv # to get pytables working within the virtual environment myvenv
    $ pip install numpy numexpr cython
    $ pip install tables

(taken from andreabedini post in https://github.com/PyTables/PyTables/issues/385)




回答4:


I tried everything without success. The only way I could I achieved was using nehalecky's answer I got here:

https://github.com/PyTables/PyTables/issues/219

In a nutshell, you should do these 2 commands, correcting the path, of course:

sudo python3 setup.py build_ext --inplace --hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial/
sudo python3 setup.py install --hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial/

Hope it helps!



来源:https://stackoverflow.com/questions/21607974/pytables-installation-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!