I'm using Anaconda python on a Mac running OS X 10.11 El Capitan.
I'm trying to use pycaffe
in iPython, but importing it (import caffe
) fails with the error
ImportError: dlopen(/Users/.../Documents/caffe-master/python/caffe/_caffe.so, 2): Library not loaded: @rpath/libcudart.7.5.dylib
Referenced from: /Users/.../Documents/caffe-master/python/caffe/_caffe.so
Reason: image not found
While iPython can't import caffe, doing so in 'ordinary' python works.
Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, May 28 2015, 17:04:42)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import caffe
>>> caffe.Net
<class 'caffe._caffe.Net'>
I should also mention that I'm using CUDA 7.5, and although I can't see which version of caffe I have (downloaded zip) it was done from the master branch on September 17 2015.
The actions I took for 'ordinary' python to be able to import caffe was to add the following to ~/.bash_profile
# added pycaffe path
export PYTHONPATH="/Users/.../Documents/caffe-master/python:$PYTHONPATH"
# needed to import pycaffe in python
export DYLD_FALLBACK_LIBRARY_PATH='/usr/local/cuda/lib:/anaconda/lib:/usr/local/lib:/usr/lib:/opt/intel/lib:/opt/intel/mkl/lib'
iPython is reading the PYTHONPATH set in .bash_profile
since it will give ImportError: No module named caffe
if the export PYTHONPATH=...
line is commented out. But for some reason it doesn't find the DYLD_FALLBACK_LIBRARY_PATH
, which 'ordinary' python does.
Any ideas on what might be wrong?