Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to locate HDF5 header file at hdf5.h #80

Open
xpchen0 opened this issue Sep 12, 2016 · 9 comments
Open

unable to locate HDF5 header file at hdf5.h #80

xpchen0 opened this issue Sep 12, 2016 · 9 comments

Comments

@xpchen0
Copy link

xpchen0 commented Sep 12, 2016

Hello:
I am using torch to run nerual talk2 , but when I run the eval.lua I got this error :

/home/dmt/torch/install/share/lua/5.1/trepl/init.lua:384: /home/dmt/torch/install/share/lua/5.1/trepl/init.lua:384: /home/dmt/torch/install/share/lua/5.1/hdf5/ffi.lua:42: Error: unable to locate HDF5 header file at hdf5.h
stack traceback:
    [C]: in function 'error'
    /home/dmt/torch/install/share/lua/5.1/trepl/init.lua:384: in function 'require'
    eval.lua:8: in main chunk
    [C]: in function 'dofile'
    .../dmt/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x00406670

I am using Ubuntu 14 and I have done follows as https://github.com/deepmind/torch-hdf5/blob/master/doc/usage.md

Ubuntu >= 13.04
sudo apt-get install libhdf5-serial-dev hdf5-tools
git clone [email protected]:deepmind/torch-hdf5.git
cd torch-hdf5
luarocks make hdf5-0-0.rockspec LIBHDF5_LIBDIR="/usr/lib/x86_64-linux-gnu/"

I don't know what is the problem .

@billzorn
Copy link

I also have this problem trying to run on Ubuntu 14.04. After examining the code that loads the header in luasrc/ffi.lua, I observed that the generated config.lua file always has an empty string for the value of _config.HDF5_INCLUDE_PATH. The loader sees this, appends the header name, tries to look for hdf5.h in the current directory or something like that, and fails.

I was able to fix this on my system by manually adding the option -DHDF5_INCLUDE_DIR="/usr/include/" in the rockspec: I changed the cmake command from

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(LUA_BINDIR)/.." -DCMAKE_INSTALL_PREFIX="$(PREFIX)";

to

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(LUA_BINDIR)/.." -DCMAKE_INSTALL_PREFIX="$(PREFIX)" -DHDF5_INCLUDE_DIR="/usr/include/";

I'm not sure if this is actually the right thing to do, or if there's a better way to pass that path along through CMake. I'm no CMake expert, and I have no idea where it's getting the library path from. The >= 13.04 documentation seems to be outdated: specifying that option doesn't do anything that I was able to observe.

@ghost
Copy link

ghost commented Oct 11, 2016

A quick fix on my Mac 10.11.6 is to go to
~/torch/install/share/lua/5.1/hdf5/config.lua
and set
hdf5._config.HDF5_INCLUDE_PATH = "/usr/local/include/",

hdf5._config = {
HDF5_INCLUDE_PATH = "/usr/local/include/",
HDF5_LIBRARIES = "/usr/local/lib/libhdf5_cpp.dylib;/usr/local/lib/libhdf5.dylib;/usr/local/lib/libsz.dylib;/usr/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib"
}

@anthonyyuan
Copy link

/Users/anthonyyuan/torch/install/bin/luajit: ...s/anthonyyuan/torch/install/share/lua/5.1/trepl/init.lua:384: ...s/anthonyyuan/torch/install/share/lua/5.1/trepl/init.lua:384: /Users/anthonyyuan/.luarocks/share/lua/5.1/hdf5/ffi.lua:42: Error: unable to locate HDF5 header file at hdf5.h
stack traceback:
[C]: in function 'error'
...s/anthonyyuan/torch/install/share/lua/5.1/trepl/init.lua:384: in function 'require'
eval.lua:8: in main chunk
[C]: in function 'dofile'
...yuan/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x0109168bc0

@anthonyyuan
Copy link

I use mac ! can u help me

@hassanshallal
Copy link

hassanshallal commented Feb 19, 2017

Hey folks, I was able to solve most of the issues of the hdf5 library by using the following config.lua, just replace yourname:

hdf5._config = {
HDF5_INCLUDE_PATH = "/Users/yourname/anaconda/pkgs/hdf5-1.8.17-1/include",
HDF5_LIBRARIES = "/Users/yourname/anaconda/pkgs/hdf5-1.8.17-1/lib/libhdf5.dylib;/usr/lib/libpthread.dylib;/usr/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib"
}

It turned out that, on my mac Sierra system and anaconda with python2.7 and 3.5 support, all I needed to get the pretty robust hdf5 package up and running is to refer to another version adopted by my anaconda installation. This way, I can, and hopefully you also can, move on...

Thanks a lot for the feedback, the feedback on the issue was instrumental to allow me to fix, or probably to get around, the issue on my own system.

@MarcoForte
Copy link

On Ubuntu I changed the line in config.lua to
HDF5_INCLUDE_PATH = "/usr/include/hdf5/serial/",

@Delasa
Copy link

Delasa commented Jul 29, 2017

I was playing with this for a few hours in mac os and the easiest solution that I found is to download the hdf5 package (I put it in the home directory) from anaconda (https://anaconda.org/anaconda/hdf5/files?version=1.8.17) and then changing the config.lua to point to the include and lib within the anaconda package:

hdf5._config = {
HDF5_INCLUDE_PATH = "/Users/Delasa/hdf5-1.8.17-2/include",
HDF5_LIBRARIES = "/Users/Delasa/hdf5-1.8.17-2/lib/libhdf5.dylib;/usr/lib/libpthread.dylib;/usr/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib"
}

@YuanEZhou
Copy link

YuanEZhou commented Nov 9, 2017

I encountered the same problem and fixed it as follow:
Firstly, I try to find the hdf5.h header file at terminal. (find / -name 'hdf5.h')
Secondly, I open ~/torch/install/share/lua/5.1/hdf5/config.lua and replace HDF5_INCLUDE_PATH = "" with HDF5_INCLUDE_PATH = "/mnt/zye/anaconda2/include ''(The directory that I find Includes the hdf5.h header file, you should change the directory according to your finding.)

@zubair82
Copy link

I'm using windows and stuck with same error i.e, "thread 'main' panicked at 'Unable to locate HDF5 root directory and/or headers.', C:\Users\zubair.cargo\registry\src\github.com-1ecc6299db9ec823\hdf5-sys-0.8.1\build.rs:548:13"

Can anyone help me ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants