Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Build pytorch, ONNX, caffe2 with Anaconda python3.6 #1204

Closed
astroli opened this issue Sep 12, 2017 · 2 comments
Closed

Build pytorch, ONNX, caffe2 with Anaconda python3.6 #1204

astroli opened this issue Sep 12, 2017 · 2 comments

Comments

@astroli
Copy link

astroli commented Sep 12, 2017

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 astroli closed this as completed Sep 21, 2017
@SinghGauravKumar
Copy link

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

@astroli
Copy link
Author

astroli commented Feb 8, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants