Installation on Ubuntu, 14.04 - waylonflinn/caffe GitHub Wiki

I am writing this guide using my installation of 14.04. I have a fresh install (no additional drivers or anything for the GPU.) I have a GTX 970.

Get the script for the virtual environment and install

cd
wget https://gist.githubusercontent.com/waylonflinn/506f563573600d944923/raw/install-python-data-science.sh
chmod a+x install-python-data-science.sh
./install-python-data-science.sh

Optional: Always open terminal into the virtual environment.

After the script finishes

vim ~/.bashrc

And add the following to the bottom:

source ~/venv/data-science/bin/activate

This will activate the virtual environment every time you open a terminal.

Set up protobuf

cd
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout tags/v3.0.0-alpha-2

You need a package called dh-autoreconf, get it if you don't have it.

apt-get install dh-autoreconf
./autogen.sh
./configure # can use --prefix=/usr here to avoid some ld_library_path issues.
make
make check
make install #probably requires sudo

Add /usr/local/lib to your LD_LIBRARY_PATH if you didn't add --prefix=/usr to the configure step. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib This can be put in ~/.bashrc

Cuda

This is the 14.04 local installer. http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/rpmdeb/cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.deb

Once you download it, run it, confirm anything the software center asks for.

sudo apt-get update
sudo apt-get install cuda

Verify that it works nvcc --version should give you no errors.

I restarted here because it installed new drivers for me.

Caffe Dependencies

Run the first batch: sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev

And the second batch: sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

Note that the second batch is NOT the same as caffe's instructions. They installed the package version of protobuf. We don't want that because it breaks stuff.

Build Caffe

cd
git clone https://github.com/waylonflinn/caffe
cd caffe
mkdir build
cd build
cmake ..

If there are any errors at this point, they'll be something like "Couldn't find some thing" you'll need to fix those before moving on.

make all -j5 #DO NOT FORGET THE 'all'!
make runtest
make install #may require sudo
make pycaffe

Running the notebook

cd
git clone https://github.com/waylonflinn/caffe-oxford102.git
cd caffe-oxford102
ipython notebook

If this is your first time running ipython, you can specify a default browser. I chose chrome.

Change the script for two things:

CAFFE_ROOT = '/your/path/to/caffe'

It'll probably be /home/{USER}/caffe if you're following this page.

Then you'll need to add the protobuf python wrappers to the pythonpath

# protobuf location
sys.path.append('/path/to/protobuf/python/build/lib')