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

Error: unable to locate HDF5 header file at hdf5.h #123

Open
kryptonish opened this Issue Jul 14, 2016 · 12 comments

Comments

Projects
None yet
@kryptonish

kryptonish commented Jul 14, 2016

In order to get neuralTalk2 working on my mac, I have looked at all possible issues that could creep up. My issues are very similar to post #10 , by trych. However, "luarocks install loadcaffe" after which neuraltalk2 seems to be working ,finally, when I run the "th" command, I get the error as shown in the heading of this post. I hope I can some assistance
screenshot 2016-07-14 14 23 01

@tbornt

This comment has been minimized.

tbornt commented Oct 18, 2016

I got the same issue and finally I found the solution.
If you install hdf5 using brew install hdf5 and after you installed torch-hdf5, you should configure conf.lua at Users/your_name/torch/install/share/lua/5.1/hdf5.
Replace the HDF5_INCLUDE_PATH = "/usr/local/Cellar/hdf5/your_version_number/include".
Replace your_name and your_version_number based on your settings.

@elSupremo

This comment has been minimized.

elSupremo commented Oct 30, 2016

Thanks! it works alright :)

@anthonyyuan

This comment has been minimized.

anthonyyuan commented Nov 25, 2016

when i use this solution ! but error is appear !!!

my conf.lua hdf5._config = {
HDF5_INCLUDE_PATH = "/usr/local/Cellar/hdf5/1.8.17/include",
HDF5_LIBRARIES = "/usr/local/lib/libhdf5_cpp.dylib;/usr/local/lib/libhdf5.dylib;/usr/local/lib/libsz.dylib;/usr/local/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib"
}
~
~

@anthonyyuan

This comment has been minimized.

anthonyyuan commented Nov 25, 2016

th eval.lua -model model_id1-501-1448236541.t7_cpu.t7 image/1.jpg
/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 0x0107482bc0

@ashwinroot

This comment has been minimized.

ashwinroot commented Mar 2, 2017

@anthonyyuan were u able to solve the error?

@hassanshallal

This comment has been minimized.

hassanshallal commented Mar 2, 2017

@ashwinroot

This comment has been minimized.

ashwinroot commented Mar 3, 2017

@hassanshallal I am using MAC OS sierra. I m still not able to download a suitable version of hdf5. I followed a lot of tutorial, yet the program throws error related to hdf5 parsing.

module 'hdf5' not found:Failed loading module hdf5 in LuaRocks rock hdf5 0-0

And while trying to install hdf5 from the steps given using github repo, I get an error as:

Could NOT find HDF5: Found unsuitable version "", but required is at least
"1.8" (found HDF5_hdf5_LIBRARY-NOTFOUND)

Is there any way I could clean the installations of hdf5 and start afresh ?

@liuxx2016

This comment has been minimized.

liuxx2016 commented May 9, 2017

@tbornt Replace the HDF5_INCLUDE_PATH = "/usr/local/Cellar/hdf5/your_version_number/include".
what' s the Cellar? I don't have the folder.

@GiriB

This comment has been minimized.

GiriB commented May 18, 2017

@liuxx2016 You should have brew installed to have the Cellar folder.

@swang

This comment has been minimized.

swang commented Aug 29, 2017

For anyone getting to this page from Google and trying to figure out how to get HDF5 to run..

First, Follow the suggestion here: http://www.jeffreythompson.org/blog/2016/03/25/torch-rnn-mac-install/comment-page-2/#comment-287591

Update: I overcame this by tapping the older brew version
I ran:

brew install hdf5@1.8

then dumped the folder contents from usr/local/Cellar/hdf5@1.8 into from usr/local/Cellar/hdf5

I then ran

brew switch hdf5 1.8.18

to choose the right hdf5 version

I made my include path in config.lua

HDF5_INCLUDE_PATH = “/usr/local/Cellar/hdf5/1.8.18/include”,

I’m sure there’s a better way of teaching brew which version to default to without dragging folders around but at least it works!

When you run brew install hdf5@1.8, it creates a folder called hdf5@1.8 in the Cellar. That folder contains a 1.18.x folder, where x is some patch version number. That's the folder that should be in /usr/local/Cellar/hdf5/

Make sure you see what version you are actually downloading. For example, as of this writing the latest 1.8.x version of hdf5 is 1.8.19.

Make sure your HDF5_INCLUDE_PATH includes the correct version number.
ALSO make sure HDF5_LIBRARIES points to the proper libhdf5 library. For example with 1.8.19, you need to include /usr/local/Cellar/hdf5/1.8.19/lib/libhdf5.dylib in HDF5_LIBRARIES.

After you get this properly, you should encounter an error when you run th -e "require 'hdf5'"

Via deepmind/torch-hdf5#83 (comment)

You need to change line 44 of that ffi.lua file from
local process = io.popen("gcc -E " .. headerPath) -- TODO pass -I
to
local process = io.popen("gcc -D '_Nullable=' -E " .. headerPath) -- TODO pass -I

I hope this helps people searching from Google

@Benimation

This comment has been minimized.

Benimation commented Oct 6, 2017

For some reason my config file contained this:
HDF5_INCLUDE_PATH = "/usr/local/Cellar/hdf5/1.8.19/include;/usr/local/opt/szip/include"

Which I simply changed to this:
HDF5_INCLUDE_PATH = "/usr/local/Cellar/hdf5/1.8.19/include"

I have no idea where the extra ;/usr/local/opt/szip/include came from..

It now works, I am using macOS High Sierra (10.13)

@jianchao-li

This comment has been minimized.

jianchao-li commented Aug 8, 2018

Hi, @Benimation. I came across the same problem and removing /usr/local/Cellar/hdf5/1.8.19/include also seemed to work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment