Caffe Installation - OX S Yosemite, 10.10.4, Macbook Air - CPU only

2,386 views
Skip to first unread message

Umar Spa

unread,
Aug 10, 2015, 4:23:30 AM8/10/15
to Caffe Users
  • Xcode installation from Apple Store
  • Homebrew installation:
  • CUDA 7 installation:
  • General Dependencies:
    • $ brew install -vd snappy leveldb gflags glog szip lmdb
    • brew tap homebrew/science
    • brew install hdf5 opencv         
    • N.B. ‘make bootstrap’ will take some time, have patience !
    • brew install --build-from-source --with-python -vd protobuf
    • brew install --build-from-source -vd boost boost-python
    • N.B. this is going to take long time as well, with lots of clang warnings.
    • $ brew install python
  • Caffe installation:
    • Go the directory where you wish to have 'caffe'. In my case it was: /Users/UmarSpa/Documents/
    • $ git clone https://github.com/BVLC/caffe.git
    • $ cd caffe
    • $ cp Makefile.config.example Makefile.config
    • Now open the Makefile.config file and make the following modifications:
      • CPU_ONLY := 1
      • PYTHON_INCLUDE := /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 \    /usr/local/Cellar/numpy/1.9.2_1/lib/python2.7/site-packages/numpy/core/include 
      • PYTHON_LIB := /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib
    • Remain in the caffe folder and execute:
    • $ make clean
    • $ make all
    • $ make test
    • $ make runtest
    • ERROR ENCOUNTERED:
      • Umars-Air:caffe UmarSpa$ make all
      • No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
      • PROTOC src/caffe/proto/caffe.proto
      • CXX .build_release/src/caffe/proto/caffe.pb.cc
      • CXX src/caffe/blob.cpp
      • In file included from src/caffe/blob.cpp:4:
      • In file included from ./include/caffe/blob.hpp:10:
      • In file included from ./include/caffe/syncedmem.hpp:7:
      • In file included from ./include/caffe/util/math_functions.hpp:11:
      • ./include/caffe/util/mkl_alternate.hpp:11:10: fatal error: 'cblas.h'
      • file not found
      • #include <cblas.h>          
      •               ^
      • 1 error generated.make: *** [.build_release/src/caffe/blob.o] Error 1
      • FIRST SOLUTION TRIED:
        • $ touch ~/.bash_profile; open ~/.bash_profile
        • add the following line in the file:  
          • export PATH=/usr/local/cuda/bin:$PATH
          • export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
        • $ source ~/.bash_profile
      • This solution didn't work [but it is still useful to add these paths in the bash_profile]
      • SECOND SOLUTION TRIED:
      • The second solution seems to solve the problem. But I am not sure which of the two points of third solution solved the error.
  • Pycaffe Installation:
    • $ for req in $(cat /Users/UmarSpa/Documents/caffe/python/requirements.txt); do pip install $req; done 
    • $ make pycaffe
    • $ touch ~/.bash_profile; open ~/.bash_profile 
    • add the following line in the file: 
      • export PYTHONPATH=/Users/UmarSpa/Documents/caffe/python:$PYTHONPATH
    • $ source ~/.bash_profile
    • $ make distribute
    • $ cd /Users/UmarSpa/Documents/caffe/python
    • $ python
    • >>> import caffe
  • If it doesn't give any error than it means that it works !!!!!

Ariel Ephrat

unread,
Aug 31, 2015, 8:13:16 AM8/31/15
to Caffe Users
Thanks so much Umar!
Your instructions prevailed where others' failed...
Message has been deleted
Message has been deleted

Igor Vishnevskiy

unread,
Sep 16, 2015, 3:01:54 AM9/16/15
to Caffe Users
Above steps worked, but instead of installing all dependencies using loop:
$for req in $(cat /Users/UmarSpa/Documents/caffe/python/requirements.txt); do pip install $req; done
... I had to manually open the "caffe/python/requirements.txt" file and install every dependency manually using:
sudo -H
example:
sudo -H pip install Cython
sudo -H pip install numpy
sudo -H pip install scipy
sudo -H pip install scikit-image
sudo -H pip install matplotlib
sudo -H pip install ipython
sudo -H pip install h5py
sudo -H pip install leveldb
sudo -H pip install networkx
sudo -H pip install nose
sudo -H pip install pandas
sudo -H pip install python-dateutil
sudo -H pip install protobuf
sudo -H pip install python-gflags>
sudo -H pip install pyyaml
sudo -H pip install Pillow
sudo -H pip install six

Umar Spa

unread,
Sep 16, 2015, 6:18:13 AM9/16/15
to Caffe Users
I just checked the loop, and for me it still works....probably you are making some mistake in the path.
Anyhow, doing it with the loop or manually is the same thing.

Lucian Ionita

unread,
Jun 19, 2016, 5:07:56 PM6/19/16
to Caffe Users
Thanks Umar! Quick and painless installation. This should be the reference for installing caffe on mac. 

Joshua peng

unread,
Oct 31, 2016, 10:11:35 PM10/31/16
to Caffe Users
I am trying to install cafe on Mac 10.12.1 sierra using , it came to have the errors below while following the described steps above:

Joshuas-MacBook-Pro:caffe Books$ make all

PROTOC src/caffe/proto/caffe.proto

CXX .build_release/src/caffe/proto/caffe.pb.cc

CXX src/caffe/blob.cpp

In file included from src/caffe/blob.cpp:7:

In file included from ./include/caffe/util/math_functions.hpp:11:

./include/caffe/util/mkl_alternate.hpp:14:10: fatal error: 'cblas.h' file not found

#include <cblas.h>

         ^

1 error generated.

make: *** [.build_release/src/caffe/blob.o] Error 1


I have tried the ways you mentioned to fix it, but none worked, I also installed Anaconda Python,not sure that is needed. 


Any help would be greatly appreciated. 


Noel Faux

unread,
Nov 10, 2016, 7:39:50 AM11/10/16
to Caffe Users
@Joshua peng  see https://groups.google.com/forum/#!topic/caffe-users/xqPDUcyOml8

You need to modify the Make file to point Caffe at cblas.
Reply all
Reply to author
Forward
0 new messages