Search code examples
pythonimportcaffe

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?


Solution

  • 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