2016.3.22 Introduce all the libraries that are often used for machine learning. The environment is Ubuntu 14.04 LTS (because this is the recommended environment for caffe and chainer)
pyenv
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc
python
pyenv install anaconda-2.1.0
pyenv rehash
pyenv global anaconda-2.1.0
echo 'export PATH="$PYENV_ROOT/versions/anaconda-2.1.0/bin/:$PATH"' >> ~/.bashrc
source ~/.bashrc
This time, I used anaconda-2.1.0 recommended by Caffe. Also, since anaconda is a numerical calculation package, it is convenient because numpy, scipy, and scikit-learn are included from the time of introduction.
Next, we introduced Caffe, Chainer, TensorFlow that we usually use from the deep learning library. Caffe
## cuda install
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
sudo apt-get install libatlas-base-dev
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
--Caffe (main body)
## caffe
cd $HOME
git clone https://github.com/BVLC/caffe.git ~/caffe
cd caffe
cp Makefile.config.example Makefile.config
### ※
echo "CPU_ONLY := 1" >> Makefile.config
echo "CXX := /usr/bin/g++-4.6" >> Makefile.config
I've finished putting it all in, so I'll do an execution test
make -j4 all
make -j4 test
make -j4 runtest
I want to use caffe with python, so I will introduce pycaffe.
##pycaffe
pip install -r ~/caffe/python/requirements.txt
sudo apt-get install python-dev python-pip python-numpy python-skimage
sudo apt-get install --no-install-recommends libboost-all-dev
echo "export PYTHONPATH=~caffe/python/:$PYTHONPATH" >> ~/.bashrc
source ~/.bashrc
make pycaffe
import caffe
If there are no particular errors, it's okay. It should be noted that here
make pycaffe
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
touch python/caffe/proto/__init__.py
PROTOC (python) src/caffe/proto/caffe.proto
>>> import caffe
Traceback (most recent call last):
File "", line 1, in
File "/home/yuki/caffe/python/caffe/__init__.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/home/yuki/caffe/python/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: /home/yuki/.pyenv/versions/anaconda-2.1.0/bin/../lib/libm.so.6: version `GLIBC_2.15' not found (required by /usr/lib/x86_64-linux-gnu/libxvidcore.so.4)
If you get an error like this, for the time being
/home/yuki/.pyenv/versions/anaconda-2.1.0/bin/../lib/libm.so.6
If you delete this file, the library will be loaded (not completely solved).
After all it is difficult to build an environment for caffe (´ ・ ω ・ `)
chainer
pip install chainer
That's it! !! It's good
Tensorflow For some reason the library is not loaded and I have a hard time [TensorFlow-Download and Setup] (https://www.tensorflow.org/versions/r0.7/get_started/os_setup.html#pip-installation)
sudo apt-get install python-pip python-dev
#CPU
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl
Recommended Posts