Installing Caffe and PyCaffe on Ubuntu 14.04

1. Install OpenCV 2.4.11

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
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

2 thoughts on “Installing Caffe and PyCaffe on Ubuntu 14.04

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s