Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add caffe to anaconda on windows?

I'm trying to use Caffe in Anaconda3 on windows, but when I try to import caffe in iPython, it shows this error:

ImportError: No module named caffe

I tried to add a new system variable named PYTHONPATH which looks like this:

C:\Users\Hadi\Anaconda3;C:\Projects\caffe\python\caffe;C:\Projects\caffe\python

It still shows the same error. I would appreciate if anyone mentioned what am I missing here?

like image 684
Hadi GhahremanNezhad Avatar asked Feb 07 '17 17:02

Hadi GhahremanNezhad


2 Answers

REM Create a new conda environment to install Caffe REM You can use python 3.5, 3.6 or 3.7

conda create -n caffe python=3.7

REM activate the environment REM Depending on your conda version you may have to use activate caffe

conda activate caffe

REM add the anaconda channel to resolve all dependencies

conda config --add channels anaconda

REM Install caffe with cuda support or install caffe-cpu if you do not want CUDA support

conda install caffe -c willyd

Answer taken from here: https://github.com/BVLC/caffe/issues/6569#issuecomment-432491851

like image 188
minar09 Avatar answered Oct 07 '22 08:10

minar09


caffe doesn't have support for windows as it have for others. After trying many things, i am able to import caffe. The best solution i find is the git link https://github.com/Microsoft/caffe .

Create a virtual environment in Anaconda, python = 3.7 and then follow the instructions.

You would have to make changes CommonSettings.props as mentioned in the documentation for CUDA and cuDNN if you would be using it with CPU only.

clone repository to the location and copy caffe folder to .\anaconda3\envs\env_caffe\Lib\site-packages location as stated in the documentation .

and finally un the following commands from elevated command prompt:

conda install --yes numpy scipy matplotlib scikit-image pip pip install protobuf.

Read the instruction carefully and then proceed.

like image 37
Shikha Avatar answered Oct 07 '22 07:10

Shikha