Hi guys, this article is about installation process of caffe2 with Anaconda Python on ubuntu(16.04). Before start, I assume that you have already installed Anaconda Python 3 version. I installed Anaconda 4.0.0 Python 3.6 version. If you did not install the Anaconda, please follow the link here.
First of all you need to know that caffe2 is not support python3 so we need to create an environment for python 2.7. To do that with Anaconda you need to run this command below.
This command will create a new virtual environment named py27 with anaconda packages (numpy, pandas etc.). Then we need to activate this newly created environment.
You must see (py27)
at the start of the location indicator of command prompt. So we are ready to go.
We need to install dependencies first, please run the instructions respectively.
Optional Installation
Caffe2 has also GPU support. If you want to use GPU instead of CPU only, you should install NVIDIA CUDA 8 and cuDNN v5.1 or v6.0.
When the installation of cuda is finished, then we continue with cuDNN
Instructions below are also optional but I really recommend them to install
Finally it is time to start installing caffe2
If your computer has a single processer then please remove the -j4 part at the end of the command. -j4 helps us to build project as parallel.
If shell echoes “Failure” then please try to import core module of caffe2 interactively using python shell. If the error is GLIBCXX_3.4.20 not found (required by caffe2/python/caffe2_pybind11_state.so)
, so you are very lucky guys. You just need to run the command below.
This will install required dependencies to our conda instance. Then you should successfully import the caffe2.
If you want to use caffe2 from any location then you need to add caffe2 to PYTHONPATH
You can adjust environment variables like below
Add these lines to end of the .bashrc
file.
Enjoy the life!! See you on next one.