Installing Caffe and PyCaffe on Ubuntu 14.04

1. Install OpenCV 2.4.11http://www.samontab.com/web/2014/06/installing-opencv-2-4-9-in-ubuntu-14-04-lts/

2. Install general dependencies

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler sudo apt-get install --no-install-recommends libboost-all-dev

CUDA: Install via the NVIDIA package instead of apt-get to be certain of the library and driver versions. Install the library and latest driver separately; the driver bundled with the library is usually out-of-date. This can be skipped for CPU-only installation.

BLAS: install ATLAS by sudo apt-get install libatlas-base-dev or install OpenBLAS or MKL for better CPU performance.

Python (optional): if you use the default Python you will need to sudo apt-get install the python-dev package to have the Python headers for building the pycaffe interface.

3. remaining dependencies for 14.04

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

3. clone and install Caffe
git clone https://github.com/BVLC/caffe
cd /path/to/caffe/folder

mkdir build 
cd build 
cmake .. 
make all 
make install 
make runtest

4. Pycaffe installation

sudo apt-get install cython

sudo apt-get install python-skimage
sudo apt-get install python-pip
sudo pip install protobuf

make pycaffe

To import the caffe Python module after completing the installation, add the module directory to your $PYTHONPATH by export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH

5. run python terminal and check by typing:
import caffe

Advertisements

8 thoughts on “Installing Caffe and PyCaffe on Ubuntu 14.04

  1. I’m trying to make pycaffe and get the following:
    CXX .build_release/src/caffe/proto/caffe.pb.cc
    In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
    .build_release/src/caffe/proto/caffe.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
    #error This file was generated by a newer version of protoc which is
    ^
    .build_release/src/caffe/proto/caffe.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
    #error incompatible with your Protocol Buffer headers. Please update
    ^
    .build_release/src/caffe/proto/caffe.pb.h:14:2: error: #error your headers.
    #error your headers.
    ^
    In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
    .build_release/src/caffe/proto/caffe.pb.h:23:35: fatal error: google/protobuf/arena.h: No such file or directory
    compilation terminated.
    Makefile:588: recipe for target ‘.build_release/src/caffe/proto/caffe.pb.o’ failed
    make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1

  2. Salam Naveed
    Thankfully I,ve reached to the point of make pycaffe on my ubuntu 16.04 based machine
    Unfortunately upon entering this command I receive the following error
    make: *** No rule to make target ‘pycaffe’. Stop.
    Kindly guide me

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s