Error loading shared library libhdf5_hl.so. #1463

Closed
ghost opened this Issue Nov 21, 2014 · 28 comments

Projects

None yet
@ghost
ghost commented Nov 21, 2014

Dear,

After sucessfully compile Caffe, I try to test with mnist dataset.
However, when I run the command "./examples/mnist/train_lenet.sh", I get the following error.

./build/tools/caffe: error while loading shared libraries: libhdf5_hl.so.8: cannot open shared object file: No such file or directory

I check my lib "usr/lib/x86_64-linux-gnu" directory, and I just see libhdf5_hl.so.7 file. So, there is a different between .8 and .7

Please help me to correct the above error.

Thank you

@ghost ghost changed the title from Error loading shared library libhdf5_hl.so.8 to closed Nov 21, 2014
@ghost ghost closed this Nov 21, 2014
@ghost ghost changed the title from closed to Error loading shared library libhdf5_hl.so. Nov 21, 2014
@ghost ghost reopened this Nov 21, 2014
@nishanwick

Hello,

I'm facing the exact same issue. Does anybody know a solution for this?

Thanks,
Nish

@shelhamer
Member

Please ask installation questions on the caffe-users mailing list. Thanks!

Check your LD_LIBRARY_PATH and make sure the libhdf5 linked during installation is the same as that in your library path.

@shelhamer shelhamer closed this Nov 27, 2014
@andyljones

I had this same problem. I found that libhdf5-dev created the files

/usr/lib/x86_64-linux-gnu/libhdf5_hl.so.7
/usr/lib/x86_64-linux-gnu/libhdf5.so.7

After copying them to the new names

/usr/lib/x86_64-linux-gnu/libhdf5_hl.so.8
/usr/lib/x86_64-linux-gnu/libhdf5.so.8

make runtest worked fine. I'm a Linux neophyte though so couldn't tell you why it was looking for the .8 files rather than the .7 files (or why my version of libhdf5-dev installed the .7 files rather than the .8 ones)

@SnShine
SnShine commented Mar 21, 2015

I have ran into the same error while running 'make runtest'. Renaming the files as suggested by @andyljones worked for me. Thank you.

@zizhaozhang

I met the similar problem with the latest caffe but can not find libhdf5_hl.so.9. I add the path in anaconda where /anaconda/lib/libhdf5_hl.so.9. It works. But I use matlab interface. After I compiled the caffee_.mexa64 and run the demo. An error occurs: caffe_.mexa64': libhdf5_hl.so.9: cannot open shared object file: No such file or directory. It seems there is a library mismatch between matlab and compile. Do you have any idea how to solve that?

@qiaohaijun

I get similar problem

libhdf5_hl.so.9: cannot open shared object file: No such file or directory

and I find I have the follow so file
./libhdf5_hl.so.8.0.1
./libhdf5hl_fortran.so.8.0.1
./libhdf5_hl_cpp.so
./libhdf5_cpp.so
./libhdf5_hl.so
./libhdf5.so
./libhdf5_fortran.so.8.0.1
./gfortran/modules/hdf5.mod
./libhdf5_hl_cpp.so.8
./libhdf5_fortran.so.8
./libhdf5_fortran.so
./libhdf5_hl_cpp.so.8.0.1
./libhdf5hl_fortran.so.8
./libhdf5.settings
./libhdf5.so.8.0.1
./libhdf5hl_fortran.so
./libhdf5.so.8

@zizhaozhang

Hi, I solved this problem yesterday. It seems c++ compiler and matlab will search /usr/lib/x86_64-linux-gnu to find libhdf5_hl.so.9 and libhdf5.so.9. If you use anaconda, there will be these version library. Simiple set a soft link to the above path.
I found another guys just change the name of these two to .9. You can have a try

@tiangolo
Contributor
tiangolo commented Jun 4, 2015

I just tried with the Anaconda LD_LIBRARY_PATH but then I had other problems with other libraries. And I think that also affects the Matlab interface, as it is not using the global .so file but the Anaconda's one.

You may try these instructions, they worked for me (but I'm not sure if they would fix the Matlab issue):

  • Go to the libraries directory:

    cd /usr/lib/x86_64-linux-gnu
    
  • Link the system version of HDF5 from 7 to 9:

    sudo ln -s libhdf5.so.7 libhdf5.so.9
    sudo ln -s libhdf5_hl.so.7 libhdf5_hl.so.9
    
  • Update the "Dynamic Linker":

    sudo ldconfig
    

I wrote a full guide for Ubuntu 14.04 that is pending in the pull request #2129, but you can try it, I just used it (and updated it for the current Caffe code) and it worked: https://github.com/tiangolo/caffe/blob/ubuntu-tutorial-b/docs/install_apt2.md

@chwangaa
chwangaa commented Jul 2, 2015

My problem is that there is no libhdf5.so.X file at all in the path. There is however, a /hdf5/serial/libhdf5.so file, and a few libhdf5_cpp.so.X and libhdf5_serial files.

Anybody help please?

@guangyu-ryan

the same problems, although the ibhdf5.so.10 can be found in anaconda/lib, it still doesn't work. However, I solved it with @tiangolo 's instructions, thanks

@andrusiak

I had the same problem with Caffe which I solved by adding ANACONDA/lib* path to LD_LIBRARY_PATH in ~.bashrc file and it fixed the issue.

export LD_LIBRARY_PATH="/usr/local/cuda/lib64"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/ubuntu/anaconda/lib"

@Chaffelson

Working on Centos7, adding the Anaconda lib to LD_LIBRARY_PATH as suggested by andrusiak has worked for me.

@asampat3090

Working on Ubuntu 14.04 using @andrusiak's solution. I just added
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/ubuntu/anaconda/lib" >> ~/.bashrc to my install script after installing Anaconda. Thanks!

@jskDr
jskDr commented Oct 15, 2015

I confirmed that the following is working, while I am considering to add library path suggested @byandrusiak which seems more systematic to me.
~/anaconda/pkgs/hdf5-1.8.15.1-1/lib$ sudo cp libhdf5.so.10.0.1 /usr/lib/x86_64-linux-gnu/
~/anaconda/pkgs/hdf5-1.8.15.1-1/lib$ sudo cp libhdf5_hl.so.10.0.1 /usr/lib/x86_64-linux-gnu/
(I try copying like that. Is it okay to solve the problem after I make symbolic links of them? --> Confirmed by myself.)

@jskDr
jskDr commented Oct 15, 2015

So, I contributed this fact to the installation guide for Ubuntu.
https://github.com/tiangolo/caffe/blob/e12f3e4c565f68111bdbab396f7b256ac57de4f5/docs/install_apt2.md

@tiangolo
Contributor

@jskDr thanks for the contribution! I tried that, but it resulted in some other errors afterwards as pointed out in this comment above: #1463 (comment) by @guangyu-ryan.

Although right now I don't remember which errors exactly.

@sophieag

Work too, thanks

@seindlut

@andrusiak Thank you. The problem has been fixed according to your advice

@biolee
biolee commented Dec 30, 2015

LD_LIBRARY_PATH=/usr/local/lib && export LD_LIBRARY_PATH && make runtest
work for me

@KnightOfTheMoonlight

I think you need to remake your caffe.

@leo-zhou

I have the same problem. But I didn't find any libhdf5 file in the /usr/lib/x86_64-linux-gnu/, so I just copy it from anaconda, then it is solved.

@link9
link9 commented Mar 6, 2016

LD_LIBRARY_PATH=/home/my_user_name/anaconda2/lib && export LD_LIBRARY_PATH && make runtest

worked for me.

@JianchaoCao

do like @link9 or do as follows:
(1) add 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib:/usr/local/hdf5/lib' to the end of file ~/.bashrc
(2) source ~/.bashrc

then run make runtest OK

@yihui-he
yihui-he commented May 9, 2016

sudo cp ~/anaconda/lib/libhdf5* /usr/lib/x86_64-linux-gnu/ works for me.

@YingChenlu

In Ubuntu15.10 with anaconda2, @andrusiak 's instruction works for me. Thanks

@RachelSun

If you use conda, the file is in the folder "anaconda/lib". So I used the "LD_LIBRARY_PATH="path to anaconda lib" && export LD_LIBRARY_PATH && make runtest. It works!

@springzfx

the version of libhdf5_hl.so is decided by what?
I have libhdf5_hl.so.8 in my system, the link is right, but it trys to find .so.9.
Why this will happen, someone can explain that?

@h4ck3rm1k3

My solution : remove anaconda from the path and rebuild.

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