Giter Site home page Giter Site logo

simple_installation_caffe2's Introduction

Simple_Installation_Caffe2

This Repo records how to install Caffe2 (in Pytorch Repo) with python virtualenv from source code.

System environment Ubuntu 16.04 40 CPU

Step 1 some system preparation!

if you have sudo, it's the best. But if you don't you can download the source code and compile from source. some of lib below are not required because third-party of caffe2 lib already have stuff. But opencv, lmdb, openmpi, gflags, glog are required. You can also compile python from source if you don't have sudo. I recommend to use python3.

sudo apt-get update sudo apt-get install -y --no-install-recommends
build-essential
cmake
git
libgoogle-glog-dev
libgtest-dev
libiomp-dev
liblmdb-dev
libopencv-dev
libopenmpi-dev
libsnappy-dev
libprotobuf-dev
openmpi-bin
openmpi-doc
protobuf-compiler
python-dev
python-pip sudo apt-get install -y --no-install-recommends libgflags-dev sudo pip install virtualenv

Step 2 virtualenv!

we create a virutalenv python in our home dir. this will be easier for reinstallation if you fail to install caffe2 at first time. I recommend you to know which python you are using. .

cd ~ virtualenv -p /usr/bib/python3(or your python bin) py3caffe2 source /home/yuxi/py3caffe2/bin/activate pip install future numpy protobuf

Step 3 download pytorch

caffe2 is in pytorch hub.

git clone --recursivehttps://github.com/pytorch/pytorch.git&& cd pytorch git submodule update --init

[important] Change CMakelist.txt in pytorch,add set(PYTHON_INCLUDE_DIR "/home/yuxi/py3caffe2/include/python3.5m") set(PYTHON_LIBRARY "/home/yuxi/py3caffe2/lib") to your CMakelist.txt. So your CMakelist.txt will be like:

project(Caffe2 CXX C) set(CAFFE2_VERSION_MAJOR 0) set(CAFFE2_VERSION_MINOR 8) set(CAFFE2_VERSION_PATCH 2) set(CAFFE2_VERSION "${CAFFE2_VERSION_MAJOR}.${CAFFE2_VERSION_MINOR}.${CAFFE2_VERSION_PATCH}") set(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO ON) set(PYTHON_INCLUDE_DIR "/home/yuxi/py3caffe2/include/python3.5m") set(PYTHON_LIBRARY "/home/yuxi/py3caffe2/lib") include(CMakeDependentOption)

make a build dir and cmake and build

mkdir build && cd build cmake .. make -j40 install DESTDIR=./INSTALL

after compilation and modify your bashrc

copy your compilation to python lib cd INSTALL/usr/local && cp -rf * ~/py3caffe2/ modify the bashrc for C++ use. export PATH=$PATH:/home/yuxi/py3caffe2/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/yuxi/py3caffe2/lib source /home/yuxi/py3caffe2/bin/activate

simple_installation_caffe2's People

Contributors

ciciling07 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.