caffe2 icon indicating copy to clipboard operation
caffe2 copied to clipboard

Build pytorch, ONNX, caffe2 with Anaconda python3.6

Open astroli opened this issue 9 years ago • 2 comments

Here is my procedures of building pytorch + caffe2 + ONNX in Ubuntu 17.04 for http://pytorch.org/tutorials/advanced/super_resolution_with_caffe2.html

Install python

./Anaconda3-4.4.0-Linux-x86_64.sh export PATH=~/anaconda3/bin:$PATH

conda install -c statiskit python-dev conda install -c conda-forge pybind11 conda install future

Build, install pytorch (torch.onnx missed)

#conda install pytorch torchvision -c soumith git clone --recursive https://github.com/pytorch/pytorch.git cd pytorch python setup.py install

Build, install ONNX

git clone https://github.com/onnx/onnx.git cd onnx python setup.py install

Build, install ONNX-CAFFE2

git clone https://github.com/onnx/onnx-caffe2.git cd onnx-caffe2 python setup.py install

Build caffe2 with python3

git clone https://github.com/caffe2/caffe2.git cd caffe2 mkdir build cd build cmake .. -DPYTHON_EXECUTABLE=~/anaconda3/bin/python -DPYTHON_LIBRARY=~/anaconda3/lib/libpython3.6m.so -DPYTHON_INCLUDE_DIR=~/anaconda3/include/python3.6m make -j4 export PYTHONPATH=pwd

Fix "CRITICAL:root:Cannot load caffe2.python. Error: ~/anaconda3/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ~/Data/caffe2/build/caffe2/python/caffe2_pybind11_state.so)"

rm ~/anaconda3/lib/libstdc++.so ~/anaconda3/lib/libstdc++.so.6 ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 ~/anaconda3/lib/libstdc++.so ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 ~/anaconda3/lib/libstdc++.so.6

Fix "CRITICAL:root:Cannot load caffe2.python. Error: ~/anaconda3/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (required by ~/Data/caffe2/build/caffe2/libCaffe2_CPU.so)"

rm ~/anaconda3/lib/libgomp.so ~/anaconda3/lib/libgomp.so.1 ln -s /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0 ~/anaconda3/lib/libgomp.so ln -s /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0 ~/anaconda3/lib/libgomp.so.1

astroli avatar Sep 12 '17 02:09 astroli

@astroli Is there a complete guide for installing, pytorch, onnx and caffe2 installation? I have anaconda2 and ubuntu 16.04

SinghGauravKumar avatar Feb 07 '18 16:02 SinghGauravKumar

Anaconda2-5.0.1-Linux-x86_64.sh

export PATH=~/anaconda2/bin:$PATH

git clone --recursive https://github.com/pytorch/pytorch.git cd pytorch/ python setup.py install cd ..

onnx-caffe2 will install caffe2, onnx and onnx-caffe2

See install.sh

git clone --recursive https://github.com/onnx/onnx-caffe2.git cd onnx-caffe2 ./install.sh

astroli avatar Feb 08 '18 13:02 astroli