`pip install tables` fail with ERROR:: Could not find a local HDF5 installation

Calvin Cheng picture Calvin Cheng · Oct 25, 2012 · Viewed 8.5k times · Source

Here's the detailed error message I am getting when I attempt to install PyTables on Mac OSX.

calvin$ pip install tables
Downloading/unpacking tables
  Downloading tables-2.4.0.tar.gz (8.9MB): 8.9MB downloaded
  Running setup.py egg_info for package tables
    /var/folders/kl/_52jng9s6sl2knv_0jds9w140000gn/T/H5close2zXB1J.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
    main (int argc, char **argv) {
    ^~~~
    /var/folders/kl/_52jng9s6sl2knv_0jds9w140000gn/T/H5close2zXB1J.c:2:5: warning: implicit declaration of function 'H5close' is invalid in C99 [-Wimplicit-function-declaration]
        H5close();
        ^
    2 warnings generated.
    ld: library not found for -lhdf5
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    * Found numpy 1.6.2 package installed.
    * Found numexpr 2.0.1 package installed.
    * Found Cython 0.17.1 package installed.
    ld: library not found for -lhdf5
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    .. 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:
    /var/folders/kl/_52jng9s6sl2knv_0jds9w140000gn/T/H5close2zXB1J.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]

main (int argc, char **argv) {

^~~~

/var/folders/kl/_52jng9s6sl2knv_0jds9w140000gn/T/H5close2zXB1J.c:2:5: warning: implicit declaration of function 'H5close' is invalid in C99 [-Wimplicit-function-declaration]

    H5close();

    ^

2 warnings generated.

ld: library not found for -lhdf5

clang: error: linker command failed with exit code 1 (use -v to see invocation)

* Found numpy 1.6.2 package installed.

* Found numexpr 2.0.1 package installed.

* Found Cython 0.17.1 package installed.

ld: library not found for -lhdf5

clang: error: linker command failed with exit code 1 (use -v to see invocation)

.. 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.

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /Users/calvin/.virtualenvs/pythontrg/build/tables
Storing complete log in /Users/calvin/.pip/pip.log

My hdf5-18 library is installed via macports. They can be found here -

calvin$ port content hdf5-18
Port hdf5-18 contains:
  /opt/local/bin/gif2h5
  /opt/local/bin/h52gif
  /opt/local/bin/h5c++
  /opt/local/bin/h5cc
  /opt/local/bin/h5copy
  /opt/local/bin/h5debug
  /opt/local/bin/h5diff
  /opt/local/bin/h5dump
  /opt/local/bin/h5import
  /opt/local/bin/h5jam
  /opt/local/bin/h5ls
  /opt/local/bin/h5mkgrp
  /opt/local/bin/h5perf_serial
  /opt/local/bin/h5redeploy
  /opt/local/bin/h5repack
  /opt/local/bin/h5repart
  /opt/local/bin/h5stat
  /opt/local/bin/h5unjam
  /opt/local/include/H5ACpublic.h
  /opt/local/include/H5AbstractDs.h
  /opt/local/include/H5Apublic.h
  /opt/local/include/H5ArrayType.h
  /opt/local/include/H5AtomType.h
  /opt/local/include/H5Attribute.h
  /opt/local/include/H5Classes.h
  /opt/local/include/H5CommonFG.h
  /opt/local/include/H5CompType.h
  /opt/local/include/H5Cpp.h
  /opt/local/include/H5CppDoc.h
  /opt/local/include/H5Cpublic.h
  /opt/local/include/H5DSpublic.h
  /opt/local/include/H5DataSet.h
  /opt/local/include/H5DataSpace.h
  /opt/local/include/H5DataType.h
  /opt/local/include/H5DcreatProp.h
  /opt/local/include/H5Dpublic.h
  /opt/local/include/H5DxferProp.h
  /opt/local/include/H5EnumType.h
  /opt/local/include/H5Epubgen.h
  /opt/local/include/H5Epublic.h
  /opt/local/include/H5Exception.h
  /opt/local/include/H5FDcore.h
  /opt/local/include/H5FDdirect.h
  /opt/local/include/H5FDfamily.h
  /opt/local/include/H5FDlog.h
  /opt/local/include/H5FDmpi.h
  /opt/local/include/H5FDmpio.h
  /opt/local/include/H5FDmpiposix.h
  /opt/local/include/H5FDmulti.h
  /opt/local/include/H5FDpublic.h
  /opt/local/include/H5FDsec2.h
  /opt/local/include/H5FDstdio.h
  /opt/local/include/H5FaccProp.h
  /opt/local/include/H5FcreatProp.h
  /opt/local/include/H5File.h
  /opt/local/include/H5FloatType.h
  /opt/local/include/H5Fpublic.h
  /opt/local/include/H5Gpublic.h
  /opt/local/include/H5Group.h
  /opt/local/include/H5IMpublic.h
  /opt/local/include/H5IdComponent.h
  /opt/local/include/H5Include.h
  /opt/local/include/H5IntType.h
  /opt/local/include/H5Ipublic.h
  /opt/local/include/H5LTpublic.h
  /opt/local/include/H5Library.h
  /opt/local/include/H5Lpublic.h
  /opt/local/include/H5MMpublic.h
  /opt/local/include/H5Object.h
  /opt/local/include/H5Opublic.h
  /opt/local/include/H5PTpublic.h
  /opt/local/include/H5PacketTable.h
  /opt/local/include/H5Ppublic.h
  /opt/local/include/H5PredType.h
  /opt/local/include/H5PropList.h
  /opt/local/include/H5Rpublic.h
  /opt/local/include/H5Spublic.h
  /opt/local/include/H5StrType.h
  /opt/local/include/H5TBpublic.h
  /opt/local/include/H5Tpublic.h
  /opt/local/include/H5VarLenType.h
  /opt/local/include/H5Zpublic.h
  /opt/local/include/H5api_adpt.h
  /opt/local/include/H5overflow.h
  /opt/local/include/H5pubconf.h
  /opt/local/include/H5public.h
  /opt/local/include/H5version.h
  /opt/local/include/hdf5.h
  /opt/local/include/hdf5_hl.h
  /opt/local/lib/libhdf5.7.dylib
  /opt/local/lib/libhdf5.a
  /opt/local/lib/libhdf5.dylib
  /opt/local/lib/libhdf5.la
  /opt/local/lib/libhdf5.settings
  /opt/local/lib/libhdf5_cpp.7.dylib
  /opt/local/lib/libhdf5_cpp.a
  /opt/local/lib/libhdf5_cpp.dylib
  /opt/local/lib/libhdf5_cpp.la
  /opt/local/lib/libhdf5_hl.7.dylib
  /opt/local/lib/libhdf5_hl.a
  /opt/local/lib/libhdf5_hl.dylib
  /opt/local/lib/libhdf5_hl.la
  /opt/local/lib/libhdf5_hl_cpp.7.dylib
  /opt/local/lib/libhdf5_hl_cpp.a
  /opt/local/lib/libhdf5_hl_cpp.dylib
  /opt/local/lib/libhdf5_hl_cpp.la
  /opt/local/share/hdf5_examples/README
  /opt/local/share/hdf5_examples/c++/chunks.cpp
  /opt/local/share/hdf5_examples/c++/compound.cpp
  /opt/local/share/hdf5_examples/c++/create.cpp
  /opt/local/share/hdf5_examples/c++/extend_ds.cpp
  /opt/local/share/hdf5_examples/c++/h5group.cpp
  /opt/local/share/hdf5_examples/c++/readdata.cpp
  /opt/local/share/hdf5_examples/c++/run-c++-ex.sh
  /opt/local/share/hdf5_examples/c++/writedata.cpp
  /opt/local/share/hdf5_examples/c/h5_attribute.c
  /opt/local/share/hdf5_examples/c/h5_chunk_read.c
  /opt/local/share/hdf5_examples/c/h5_compound.c
  /opt/local/share/hdf5_examples/c/h5_drivers.c
  /opt/local/share/hdf5_examples/c/h5_elink_unix2win.c
  /opt/local/share/hdf5_examples/c/h5_extend_write.c
  /opt/local/share/hdf5_examples/c/h5_extlink.c
  /opt/local/share/hdf5_examples/c/h5_group.c
  /opt/local/share/hdf5_examples/c/h5_mount.c
  /opt/local/share/hdf5_examples/c/h5_read.c
  /opt/local/share/hdf5_examples/c/h5_ref2reg.c
  /opt/local/share/hdf5_examples/c/h5_reference.c
  /opt/local/share/hdf5_examples/c/h5_select.c
  /opt/local/share/hdf5_examples/c/h5_shared_mesg.c
  /opt/local/share/hdf5_examples/c/h5_write.c
  /opt/local/share/hdf5_examples/c/ph5example.c
  /opt/local/share/hdf5_examples/c/run-c-ex.sh
  /opt/local/share/hdf5_examples/hl/c++/ptExampleFL.cpp
  /opt/local/share/hdf5_examples/hl/c++/ptExampleVL.cpp
  /opt/local/share/hdf5_examples/hl/c++/run-hlc++-ex.sh
  /opt/local/share/hdf5_examples/hl/c/ex_ds1.c
  /opt/local/share/hdf5_examples/hl/c/ex_image1.c
  /opt/local/share/hdf5_examples/hl/c/ex_image2.c
  /opt/local/share/hdf5_examples/hl/c/ex_lite1.c
  /opt/local/share/hdf5_examples/hl/c/ex_lite2.c
  /opt/local/share/hdf5_examples/hl/c/ex_lite3.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_01.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_02.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_03.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_04.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_05.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_06.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_07.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_08.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_09.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_10.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_11.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_12.c
  /opt/local/share/hdf5_examples/hl/c/image24pixel.txt
  /opt/local/share/hdf5_examples/hl/c/image8.txt
  /opt/local/share/hdf5_examples/hl/c/pal_rgb.h
  /opt/local/share/hdf5_examples/hl/c/ptExampleFL.c
  /opt/local/share/hdf5_examples/hl/c/ptExampleVL.c
  /opt/local/share/hdf5_examples/hl/c/run-hlc-ex.sh
  /opt/local/share/hdf5_examples/hl/run-hl-ex.sh
  /opt/local/share/hdf5_examples/run-all-ex.sh

How do I let my pip install tables know where to look for my hdf5 installation?

Answer

Calvin Cheng picture Calvin Cheng · Oct 25, 2012

Because I am using macports, with hdf5-18 already installed, it was as simple as specifying

export HDF5_DIR=/opt/local

in my ~/.bash_profile file and opening a new tab (terminal instance) so that this HDF5_DIR environment variable is available.

In my new/refreshed terminal instance, pip install tables will compile correctly and links to my hdf5 libraries (which was installed via macports). Yay!