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.
#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
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
# 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
#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
$ 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
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
.
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