6

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.

Emanuele Paolini
  • 9,912
  • 3
  • 38
  • 64

5 Answers5

14

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.

john_science
  • 6,325
  • 6
  • 43
  • 60
csirac2
  • 176
  • 1
  • 5
2

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)

1

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.

Owen
  • 171
  • 1
  • 7
1

Perhaps you can install the stable wheel file for your os for pytables from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pytables

Use this command to check for which file to download path/to/pythonX.Y -m pip debug --verbose

And this command to install the wheel file pip install C:/some-dir/some-file.whl

atufa shireen
  • 371
  • 3
  • 11
0

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!

LucasBr
  • 461
  • 1
  • 7
  • 19