ubuntu16.04 install caffe cpu version

Copyright statement: This article is the original article of the blogger and may not be reproduced without the permission of the blogger. https://blog.csdn.net/qq_25737169/article/details/77773884

This content is from the Linux Commune. There are still some problems with the installation according to the original tutorial, which are solved here.

Part 1: Install 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

sudo apt-get install libatlas-base-dev

sudo apt-get install libhdf5-serial-dev

PYTHON requires version 2.7, which is already installed by the operating system itself. Enter python2.7 --version and the specific version number will be displayed indicating that it is installed.

But you also need sudo apt-get install python-dev

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

( It doesn't matter what folder all the above sudo apt-get enters.)

Then download the source code of CAFFE: git clone https://github.com/BVLC/caffe.git

( (Of course, if you don't have GIT installed, you must install it first)

After the download is complete, use the cd command in the command line, for example, $cd ./caffe/python, enter the caffe folder, enter the python folder inside, and then enter the following code in the command line, and enter the semicolon.

for req in (cat requirements.txt); do pip install $req; done

( If PIP is not installed, install it first: sudo apt install python-pip)

Part 2: Install CAFFE

Go to the CAFFE folder and use the template to write a Makefile.config. Specifically, copy Makefile.config.example and rename it to Makefile.config

cp Makefile.config.example Makefile.config

This command is to copy the file and rename it

Whatever else you find you need goes here.

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial

Ready.

make pycaffe

make all

make test

make runtest

-The result shows that ALL TESTS PASSED is installed, just add a PYTHONPATH;

In addition, this make uses single-core CPU operation by default. If you want to be faster, for example, I want to use quad-core, add the -j4 tag after make.

If you want to try again after reporting an error in one of the above 4 lines, it is recommended to make clean first and then start again.
Compilation takes time,

Part 3: Setting up Python Caffe

Go to the python folder in the CAFFE folder and record the current path (pwd). Then enter the following command (put the recorded path in the corresponding place)

export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH

At this time it should be fine, try it out:

$ python2.7

Python 2.7.12 (default, Jul  1 2016, 15:12:24)

[ GCC 5.4.0 20160609] on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

import caffe

caffe.version

Press Enter to view the version of caffe

The installation is complete!

Note: The previous export operation is only temporary, if you encounter import caffe failure to reopen the command window. When prompted that there is no model of caffe, you need to set environment variables and enter in the command line
export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH

/path/to/caffe/python is the python folder path under the folder where you installed caffe, sudo vim /etc/profile If you don’t have vim, you can also use sudo gedit /etc/profile and then add this sentence

export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH add it to the opened file,

/path/to/caffe/python is the python folder path under the folder where you installed caffe,

Finally, run a command: source profile is complete, import caffe again without error

Part 4: Errors

Basically all errors are due to the lack of dependencies or the wrong path, so the medicine is prescribed according to the specific error information. For example:

pip install scikit-image

Many people have encountered various errors when installing CAFFE. Please be patient and Google more. It will be done.

Matlab2014a+Anaconda2+OpenCV3.1+Caffe installation under Ubuntu 16.04http://www.linuxidc.com/Linux/2016-07/132860.htm

CUDA7.5 configuration Caffe tutorial under Ubuntu 16.04 system http://www.linuxidc.com/Linux/2016-07/132859.htm

Caffe installation under Ubuntu 14.04 64bit http://www.linuxidc.com/Linux/2015-07/120449.htm

The deep learning framework Caffe is compiled and installed under Ubuntu http://www.linuxidc.com/Linux/2016-07/133225.htm

Caffe + Ubuntu 14.04 64bit + CUDA 6.5 configuration instructions http://www.linuxidc.com/Linux/2015-04/116444.htm

Install Caffe on Ubuntu 16.04 http://www.linuxidc.com/Linux/2016-08/134585.htm

Caffe configuration concise tutorial (Ubuntu 14.04 / CUDA 7.5 / cuDNN 5.1 / OpenCV 3.1) http://www.linuxidc.com/Linux/2016-09/135016.htm

Recommended Posts

ubuntu16.04 install caffe cpu version
Install the CPU version of Caffe on Ubuntu
Install Caffe under Ubuntu 14.04
Install TensorFlow (python2.7 version) on Ubuntu
Install the latest Python 3.6 version on Ubuntu
ubuntu18.04 install python2
ubuntu18.04 install docker
ubuntu12.04 install python3
Ubuntu install guide
ubuntu install nodejs
ubuntu 16 install asp.net
ubuntu install leanote
ubuntu install Jenkins
docker install ubuntu
ubuntu install elasticsearch
Install jetty in Ubuntu 18.04 Server, non-apt version
ubuntu16.0.1 install pagoda
ubuntu18.04 install python
ubuntu 18.04 install teamviewer
ubuntu install sendmail
Install the old version of seurat under Ubuntu
Ubuntu18.04 switch Python version
install vscode on ubuntu18
Install node.js under Ubuntu
Install mysql-pytho in Ubuntu
ubuntu install zsh terminal
Install Redis on Ubuntu
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install python3.6 under Ubuntu 16.04
Install docker on Ubuntu
Ubuntu18.04 install opencv 3.2.0 solution
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Ubuntu16.04 switch python version
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
ubuntu install harbor warehouse
Install mysql on Ubuntu 14.04
Ubuntu16.04 install Mongodb tutorial
Install Django on ubuntu
Install Pytorch+CUDA on Ubuntu 16.04
2018-09-11 Install arduino under Ubuntu
Install Python3 on Ubuntu 14.04
Ubuntu18.04 install Asterisk16.10 + FreePBX15.0
Ubuntu19 install MySQL pit
ubuntu16.04 install node.js, npm
Install rJava on Ubuntu18
Install JDK10+ on Ubuntu
pcduino ubuntu install os
Install python in Ubuntu
Install JDK in Ubuntu19.10
Install Python3 on Ubuntu 16.04
Install ROS under ROS Ubuntu 18.04[2]
Install MySQL under Ubuntu
Install KDE on Ubuntu16.04.2
ubuntu install nginx server
Install Yarm-PM2 under Ubuntu
Install Docker on Ubuntu18