[PYTHON] Install Caffe on Ubuntu 14.04 (CPU mode)

About the installation procedure of Caffe. CPU mode edition. It's more annoying when using a GPU, but it also takes enough time. I tried it on VirtualBox. (Ubuntu14.04 LTS) You can do it almost as follows, but some supplements are provided. Reference: Caffe installation procedure memo on Ubuntu 14.04

Please be aware that sometimes both apt and pip will fail to install.

CUDA installation

#Install the latest version
$ wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.0-28_amd64.deb
$ sudo dpkg -i cuda-repo-ubuntu1404_7.0-28_amd64.deb
$ sudo apt-get update
$ sudo apt-get install cuda

BLAS installation

Matrix calculation library. It seems that MKL, OpenBLAS, etc. are fine, but ATLAS seems to be the default, so install this.

$ sudo apt-get install libatlas-base-dev

Other dependencies

# g++Must be this version.
$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler g++-4.6

Download Caffe

#If git is not included
$ sudo apt-get install git

#Place it directly under home. If you understand, please go wherever you like.
$ cd
$ git clone https://github.com/BVLC/caffe.git

Makefile.config settings

$ cd caffe
$ cp Makefile.config.example Makefile.config
$ vi Makefile.config

Makefile.config


#Uncomment line 8
# CPU_ONLY := 1
↓
CPU_ONLY := 1

#Uncomment line 12 and specify version
# CUSTOM_CXX := g++ 
↓
CUSTOM_CXX := g++-4.6

#Line 15. You should probably change it. Match the version. Check with ls.
CUDA_DIR := /usr/local/cuda
↓
CUDA_DIR := /usr/local/cuda-7.0

compile

Parallel processing can be done by doing $ make -j4 all. The number is the number of CPU cores. It takes time, so it is recommended to do it with full power.

$ make all
$ make test
$ make runtest

If all the tests pass, the caffe environment construction is complete. If it fails, fix the problem, then do $ make clean and start over with $ make all.

Building an environment for using Caffe with Python

Package manager for python

$ sudo apt-get install python-pip

Required when inserting scipy below.

$ sudo apt-get install gfortran

Install required libraries with pip

$ for req in $(cat ~/caffe/python/requirements.txt); do sudo pip install $req; done

Installation of missing libraries

$ sudo apt-get install python-dev python-numpy python-skimage

compile.

$ make pycaffe

Pass through.

$ vi ~/.bashrc

~/.bashrc


#Write in a suitable place
export PYTHONPATH=~/caffe/python/:$PYTHONPATH

To reflect

$ source ~/.bashrc

later

$ python
>>> import caffe

OK if caffe is loaded with. thank you for your hard work.

Recommended Posts

Install Caffe on Ubuntu 14.04 (CPU mode)
Install Caffe on Ubuntu 14.04 (GPU)
Install Caffe running 3D-CNN on clean Ubuntu 14.04
Install TensorFlow on Ubuntu
Install PySide2 on Ubuntu
Install JModelica on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Install Caffe on Mac
Install Theano on Ubuntu 12.04
Install angr on Ubuntu 18.04
Install pip / pip3 on Ubuntu
How to install Deep Learning framework Caffe on Mac in CPU mode
Install GoLand IDE on Ubuntu
Install OpenCV on Ubuntu + python
wsl Install PostgreSQL on Ubuntu 18.04
[ROS] Install ROS (melodic) on Ubuntu (18.04)
Install Docker on WSL Ubuntu 18.04
Install CUDA10.1 + cuDNN7.6.5 + tensorflow-2.3.0 on Ubuntu 18.04
Install Python 3.8 on Ubuntu 18.04 (OS standard)
Install Mecab and mecab-python3 on Ubuntu 14.04
Install and run dropbox on Ubuntu 20.04
Install OpenCV and Chainer on Ubuntu
Install CUDA 8.0 and Chainer on Ubuntu 16.04
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Install fabric on Ubuntu and try
Install Python 3.9 on Ubuntu 20.04 (OS standard?)
Install confluent-kafka for Python on Ubuntu
Install Python 2.7 on Ubuntu 20.04 (OS standard?)
How to install Go on Ubuntu
ROS study # 1 Install ros-noetic on ubuntu 20.04
Notes on installing Caffe in CPU mode on Mac OSX 10.11 (El Captain)
Steps to install Python environment on Ubuntu
Install Pleasant on Ubuntu 20.04 (.NetCore3.1 / PostgreSQL version)
Install ubuntu on 32bit UEFI Ultra Notebook
Install Puppet Master and Client on Ubuntu 16.04
How to install php7.4 on Linux (Ubuntu)
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
Shebang on Ubuntu 20.04
I can't install Dask with pip on Ubuntu
CPU usage is 100% when using pygame on Ubuntu 16.04
Install python package in personal environment on Ubuntu
[Procedure memo] Install Python3 + OpenSSL locally on Ubuntu
[Note] Install wxPython 3.x on Linux Mint (Ubuntu)
Install the latest Cuda + CuDNN on Ubuntu 18.04 @ Spring 2020
Install MongoDB on Ubuntu 16.04 and operate via python
Install Ubuntu 20.04 LTS (Server) 64bit version on RaspberryPi3B +
Install mecab on Marvericks
Install python on WSL
Install pyenv on mac
Install pip on Mavericks
Install the latest version of CMake on Ubuntu 18.04.4 LTS
Install Python on Pidora.
Install mongodb on termux
Install Scrapy on python3
Install Apache Tomcat 9 on Ubuntu 19.10 Eoan Ermine Hello World
Install docker on Fedora31
Install Apache 2.4 on Ubuntu 19.10 Eoan Ermine and run CGI
Install numba on CentOS 7.2
Install Ansible on Mac
Install Python on Mac
How to install caffe on OS X with macports