Hi,
I've been trying to set up caffe with the python wrapper on OSX, but running into some trouble. I think I've got a mistake in my environment. Would somebody who has successfully done this mind comparing environmental variables with me?
I've gotten quite stuck. I can make all, and make pycaffe, but when I try to import caffe in python I get various errors depending on my dyld paths:
I have DYLD_FALLBACK_LIBRARY_PATH=$CUDA_PATH/lib:/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH
and DYLD_LIBRARY_PATH=$ANACONDA_PATH/lib:$DYLD_LIBRARY_PATH
which gives an error "Reason: Incompatible library version: libopencv_highgui.2.4.dylib requires version 8.0.0 or later, but libtiff.5.dylib provides version 7.0.0". I believe this is because the anaconda version of libtiff is one version lower than the version of lib tiff in /usr/local/lib
So I can either remove libtiff from anaconda, or add /usr/local/lib to the dyld path before anaconda, but that gives me the error
Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libjpeg.8.dylib
Which as far as I can tell, is caused by /usr/local/lib being in the dyld path.
I've also tried removing DYLD_LIBRARY_PATH, and setting
DYLD_FALLBACK_LIBRARY_PATH=$CUDA_PATH/lib:$ANACONDA_PATH/lib:/usr/local/lib:/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH
like they recommend in the installation instructions, but that has resulted in
Fatal Python error: PyThreadState_Get: no current thread
I presume this is because some of the default python libraries are interfering with Anaconda in some way, since Anaconda isn't in the dyld library path.
If anybody has been in this situation before, a point in the right direction would be much appreciated!
@Graydyn Did you follow the steps mentioned on caffe's installation page? Ensure that all libs that caffe needs are using libstdc++.
The next thing to do is to ask yourself whether you can live with anaconda's python installation instead of home-brew or macport version. I use anaconda as my only python installation on my system (from what I'm aware of anyway).
Hi Vimal,
Yup, I've got all my libs using libstdc++. Unless I'm mistaken, if I had missed any of those I wouldn't be able to compile.
Are you suggesting that I should delete the pre-installed OSX version of Python? If that has worked for you then I'll give it a go, but I didn't really think it would be necessary.
DYLD_FALLBACK_LIBRARY_PATH=$ANACONDA/lib:/usr/local/cuda/lib:/usr/local/lib:/usr/local/cuda/lib:/usr/local/lib should work as long as all the dependencies including boost python are installed with the Python for Caffe. That is, compilation needs to be paired with usage so boost python needs to be built against Anaconda if using Anaconda.
Please ask installation questions on the caffe-users mailing list. Thanks!
I had a similar issue with linking during make test, due to Anaconda's libtiff causing problems. Perhaps this is because I have a new version of Anaconda installed. Anyway, the fix for me was:
conda remove libtiff
Russell91 -- Thank you! Had the same problem and this fixed it.
Most helpful comment
I had a similar issue with linking during make test, due to Anaconda's libtiff causing problems. Perhaps this is because I have a new version of Anaconda installed. Anyway, the fix for me was:
conda remove libtiff