-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Build pytorch, ONNX, caffe2 with Anaconda python3.6 #1204
Description
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