-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
PyCaffe import failing "Library not loaded ... Reason: image not found" #2720
Comments
almost same issue here. followed all instructions and fixed the boost incompatibility problem, import gives me this error, though hd5 is installed:
|
Has anyone figured this out? I have the same issue:
Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/caffe/**init**.py", line 1, in
from .pycaffe import Net, SGDSolver
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/caffe/_caffe.so, 2): Library not loaded: @rpath/libcaffe.so
Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/caffe/_caffe.so
Reason: image not found
I am using macports installed caffe, all the dependencies also form macports. I did not do any of the compilation stuff on their site, because I did not know how to make it work with the macports install. I would suspect that this is the source of the issue. Any help/advice? |
So I was able to fix the libcudart issue by adding Will investigate this one now. |
I am also on OSX 10.10 and encountering the "Library not loaded: @rpath/libcaffe.so" issue. I followed this install guide by robertsdionne, fixed the boost issue like this, and have tried every combination of manually setting the DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH that I can think of (or have come across online). Has anyone used other solutions? I have the following relevant changes to my .bash_profile:
|
Okay no fix yet but I think I found the source of this issue: a glance at I tried Does anyone know how to get the appropriate version of libhdf5 installed? Brew seems to be showing the most up to date package so this is a bit odd. |
I have solved the issue I personally was having by reviewing this guide. I changed the following in my bash_profile:
to
(Removed the distribute part of the path.) Hopefully this will help someone solving the same issue. |
That didn't work for me (I followed the same guide, thanks for posting here). My |
Try removing the brew install of hdf5 if you're using anaconda. Anaconda comes packaged with hdf5 (~/anaconda/lib has the dylib files). You can alternatively copy the files from the anaconda directory into /usr/local/lib. |
@creynold that was smart, thanks. Resolves the hdf5 dylib error. Getting a segfault now, however:
I tried resolving per the solutions here but I believe I am already referencing the correct (Anaconda) Python. Any ideas? |
Hello, I have encountered the problem: |
Closing as this looks like a usage issue/installation question. This tracker is reserved for specific Caffe development issues and bugs; please ask usage questions on the caffe-users list. For more information, see our contributing guide. Thanks! |
Just incase anyone else is stuck with this issue. I was facing the same problem I am using the anaconda python distribution and adding the libs to
I followed this wiki. |
thanks, kunalghosh! |
thanks, kunalghosh |
I have the same error on OS X 10.11.1, with anaconda. I tried all the methods list above, but none of them worked.
|
similar issue here (OSX 10.11 with anaconda as well)
No idea of what's going on... |
Ran into this as well after the upgrade to 10.11 - decided to try and rebuild caffe - huge headache. After fixing - e.g. downgrading to - Running
I think I'm now running into issues where OSx python and Homebrew python are crossing the streams... resulting in total protonic reversal... Scratching my head on what to do next. |
It appears that El Capitan made changes to how the OS treat DYLD_ prefix variables - specifically, it seems that the OS unset the variables when running scripts (e.g. the ipython command is usually a script, or the runtests command). I couldn't find any official documentation about this behavior, but there are references from other open source projects:
It seems that the way to solve this is to remove the dependency on the DYLD_FALLBACK_LIBRARY_PATH environment variable, as suggested by the second link above:
|
Thanks @orsharir for finding this. That seems super relevant. I'm a bit lost now: is there something I should do on my side or wait for a kind of fix from caffe (or try to make one)? |
Long term I guess this should be fix officially by caffe, by removing the dependence on DYLD_FALLBACK_LIBRARY_PATH. I'm afraid I don't have the proficiency to make that fix myself. For the near term you can turn off System Integrity Protection, which return the system to the previous behavior, but leave your system vulnerable to all kind of attacks. You can also try to work around some of the issues by creating .bashenv script (similar to .bash_profile) where you set your DYLD_FALLBACK_LIBRARY_PATH variable, and add to your .bash_profile the line 'export BASH_ENV=~/.bashenv' - this forces the system to run .bashenv before every non-interactive bash session (i.e. bash scripts). This last part resolved the problems I had with ipython, but still doesn't resolve the issue of running 'make runtest'. |
@orsharir could you post a new issue with these El Capitan details so that we have an OS X build TODO to track? Thanks for looking into this. |
Of course. This is the issue I've opened #3227. |
@jpipas I am running into the same issue that you posted. Did you find a way to resolve this? |
I have the same problem for my Macpro os x 10.11.6, .build_release/tools/caffe And i tried the insall_name_tool solution and the DYLD_FALLBACK_LIBRARY_PATH, neither of them works. I guess this is a common problem for Mac users, dont you have some solution for this???? |
This solved my problem. |
mac os,I see the http://akmetiuk.com/blog/2016/03/29/compiling-caffe.html to solve my problem. |
I have solved this problem, does anyone need help? |
It's sort of complicated I mean, so if there is no one needs help, I would not bother to board the solution. |
@BluebirdStory i think i have a similar problem with pytorch v1.0.0
can you please help me fix this problem? |
i have fix it running this command : |
Running OS X 10.10.4 I have compiled successfully against Anaconda and Matlab, completed all installation steps and fixed the known boost incompatibility problem.
However Caffe still fails to import properly in Python (executed again in iPython for readability):
Since everything tested and compiled correctly, and the caffe module is located, I can't figure out why the library is not loading properly. I've tried reinstalling the Cuda driver and toolkit which did not make a difference.
The text was updated successfully, but these errors were encountered: