How to Install Caffe

Install Caffe on Linux Ubuntu 16.04

My Configurations

  • Linux: Ubuntu 16.04 LTS
  • Anaconda: Anaconda 2 (64-bit),
  • CPU or GPU: CPU

Install Caffe

1. Install CUDA 8 (Optional. I failed this installation.)

Go to the CUDA download page(

Go to the directory where the downloaded file is located.

I got an error.

Hit CTRL+ALT+F1 and login using your credentials.


2. Install Anaconda

Go to the Anaconda download website(

Download Anaconda Python 2.7 version for Linux. I downloaded in /home/sjcho/Downloads. My user name is sjcho.

Then, install Anaconda.

Update Anaconda with default settings.

Install OpenCV3.

Add the following lines in the end of the file.bashrc. .bashrc is located in the home folder /home/sjcho.

3. Build Caffe

Install dependencies.

Clone the Caffe directory in GitHub. My Caffe directory is going to be /home/sjcho/caffe.

Set build settings of Caffe.

I edited the file Makefile.config as follows using gedit.

Build Caffe.

I bumped into the errors as follows.

These errors were resolved by the following command.

Rerun the command make runtest.

The results represent the command make runtest was successfully operated.

Add the following line in the end of the file.bashrc.

Although I was not sure whether pyCaffe is necessary, I built pyCaffe.

Although I was not sure whether the following updates are necessary, I updated the packages.

Check whether Caffe has been successfully installed.

The version of Caffe was returned as 1.0.0-rc4.

4. Test an Example

First, I tested the example Image Classification and Filter Visualization in the Caffe homepage.  Download the iPython notebook into the directory /home/sjcho/caffe/python. Then, execute Jupyter Notebook.

Open the downloaded jupyter notebook and test each instruction.

My test result of 00-classification.ipynb

How to Roll Back Installations

1. Roll Back Caffe Build

Just delete the folder /home/sjcho/caffe/build.

2. Roll Back Anaconda Installation

anaconda-clean reverts to the origin system settings before the installation.



Leave a Reply

Your email address will not be published. Required fields are marked *