Skip to content

Instantly share code, notes, and snippets.

@agalea91
Created June 2, 2016 09:24
Show Gist options
  • Save agalea91/69289f21528270f07e71fb7dd09caf8d to your computer and use it in GitHub Desktop.
Save agalea91/69289f21528270f07e71fb7dd09caf8d to your computer and use it in GitHub Desktop.
___________________________________
TO MAKE CAFFE (NOT FROM SCRATCH)
make all -j2; make pycaffe -j2
make distribute
export PYTHONPATH="/Users/kristinhebert/Documents/GitClones/caffe/distribute/python:$PYTHONPATH"
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:/Users/kristinhebert/Documents/GitClones/caffe/distribute/lib:/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH
__________________________________
HOW I GOT IT WORKING with CUDA-7.5:
follow this guide (not using anaconda python):
https://gist.github.com/robertsdionne/f58a5fc6e5d1d5d2f798
with help from this guide:
https://haduonght.wordpress.com/2015/02/21/install-caffe-on-mac-os-x-10-10/
if I was doing it again I might use this guide directly from the caffe site as well as anaconda python:
http://caffe.berkeleyvision.org/install_osx.html
I’ve included the final makefiles as Makefile.config.final and Makefile.final in the caffe_bullshit folder
**CHANGES FROM GUIDE**
this is important. to deal with the error (when trying to import caffe):
ImportError: dlopen(…): Library not loaded: libpython2.7.dylib
Referenced from: /usr/local/opt/boost-python/lib/libboost_python.dylib
Reason: image not found
I added /usr/lib to the export path as follows:
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:/Users/kristinhebert/Documents/GitClones/caffe/distribute/lib:/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH
The python path from the guide was ok:
PYTHONPATH="/Users/kristinhebert/Documents/GitClones/caffe/distribute/python:$PYTHONPATH"
After doing this I immediately get the error (when trying to import caffe):
Fatal Python error: PyThreadState_Get: no current thread
so, as recommended by the 2nd guide, I re-installed python with home-brew:
brew uninstall boost-python
brew install --build-from-source --fresh -vd boost-python
This was a helpful post (from https://github.com/BVLC/caffe/issues/2720):
Just incase anyone else is stuck with this issue.
I was facing the same problem dyld: Library not loaded: libhdf5_hl.10.dylib while running make runtest and also while importing caffe in my python interpreter.
I am using the anaconda python distribution and adding the libs to DYLD_FALLBACK_LIBRARY_PATH fixed the problem.
export ANACONDA_HOME=$HOME/anaconda
export DYLD_FALLBACK_LIBRARY_PATH=$ANACONDA_HOME/lib:/usr/local/lib:/usr/lib
I followed this wiki[1].
[1] - https://haduonght.wordpress.com/2015/02/21/install-caffe-on-mac-os-x-10-10/
OLD goodies to help with deep dream (more specifically caffe) install:
setting paths:
export PYTHONPATH="/Users/kristinhebert/Documents/GitClones/caffe/distribute/python:$PYTHONPATH"
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:/Users/kristinhebert/Documents/GitClones/caffe/distribute/lib:$DYLD_FALLBACK_LIBRARY_PATH
error: python.h not found
solution:
http://stackoverflow.com/questions/31358451/make-pycaffe-fatal-error-python-h-file-not-found
https://victorfang.wordpress.com/2016/02/18/how-to-install-caffe-on-mac-os-x-yosemite-10-10-4/
# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it’s in root.
ANACONDA_HOME := $(HOME)/anaconda
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
$(ANACONDA_HOME)/include/python2.7 \
$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
error: ImportError: dlopen(/Users/kristinhebert/Documents/GitClones/caffe/distribute/python/caffe/_caffe.so, 2): Library not loaded: libpython2.7.dylib
solution:
https://github.com/BVLC/caffe/issues/2320
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:/usr/lib:/Developer/NVIDIA/CUDA-7.5/lib:
error: ImportError: dlopen(/Users/kristinhebert/Documents/GitClones/caffe/distribute/python/caffe/_caffe.so, 2): Library not loaded: @rpath/libcaffe.so.1.0.0-rc3
solution:
https://github.com/BVLC/caffe/issues/3628
After make test in $CAFFE_ROOT:
cp -a .build_release/lib/. /usr/local/lib/
—————————
got warnings during makes:
unused path—>
-L/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment