Caffe: Error 'fatal error: pyconfig.h: No such file or directory' when executing 'make pycaffe' on dev-branch

Created on 13 May 2014  ·  31Comments  ·  Source: BVLC/caffe

i have the following error when I run 'make pycaffe' on dev branch. im using CPU

/usr/bin/g++ -shared -o python/caffe/_caffe.so python/caffe/_caffe.cpp \
        build/lib/libcaffe.a -pthread -fPIC -DNDEBUG -O2 -I/usr/local/include/python2.7 -          I/usr/local/lib/python2.7/dist-  packages/numpy/core/include -I/usr/local/include -Ibuild/src -I./src -I./include -I/usr/local/cuda/include -L/usr/local/lib -L/usr/local/lib -L/usr/lib -L/usr/local/cuda/lib64 - L/usr/local/cuda/lib -lcudart -lcublas -lcurand -lpthread -lglog -lprotobuf -lleveldb -lsnappy -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_highgui -lopencv_imgproc -lcblas -latlas -  lboost_python -lpython2.7
     In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,
                  from /usr/include/boost/python/args.hpp:8,
                 from /usr/include/boost/python.hpp:11,
                 from python/caffe/_caffe.cpp:8:
          /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or         directory
       compilation terminated.
       make: *** [python/caffe/_caffe.so] Error 1

Can anybody help , thanks

SOLVED

Most helpful comment

export CPLUS_INCLUDE_PATH=/usr/include/python2.7
it works for me

All 31 comments

I'm getting the same error, could you please provide some information of how you solved it?

FIXED. PYTHONPATH was wrong...

How did you solve it? How to reset PYTHONPATH?
It is said to add "export PYTHONPATH=/path/to/caffe/python" to ~/.bashrc . But it is no use. Should I restart my computer?

same error...

just this : export PYTHONPATH=/path/to/caffe/python and it works

Hi, codetrash, I typed export PYTHONPATH=/home/XXXX/Caffe/python and make pycaffe, but I still get that error, can you help me to fix it ? thanks

try to 'make clean' , and then 'make all', etc again...

if it doesnt work still...you need to check all dependencies

I found that If I use an earlier version of Caffe, there is no error. But when it comes to the latest version (I checked out two days ago), that error occurs.

yes i experienced that too

.....the installation documentation maybe has not been updated yet...dunno...

export CPLUS_INCLUDE_PATH=/usr/include/python2.7
it works for me

Thanks @hsinfu , it works for me too!

Also solve my issue, thank you

Thanks @hsinfu , it works!

@codetrash Thanks! your suggestion works for me

@ghost thank you! it works for me!

Thanks @ghost and codetrash, It works after I tried the following 3 steps:

make clean
export CPLUS_INCLUDE_PATH=/usr/include/python2.7
make all -j8

Thanks @yuliliang It works for me!

@ghost , Thanks. It worked for me. :+1:

@ghost, thanks. It worked for me. Just curious, how were you able to figure that out?

@yuliliang Thanks! It works for me too!

Thanks @ghost!

thanks man!
work fine here!

it works! thanks @ghost

thanks @ghost !

thanks @ghost !

@ghost is rad. One note, I am building with anaconda and the path on fedora (and probably most distros) is /path/to/anaconda3/include/python3.5m/

This threw me off because I am normally on Windoze and the anaconda directory structure is quite different there.

@dmedine Thanks! I was working with Anaconda as well, and I had forgotten to change my path with respect to Anaconda.
I used this command line:

export CPLUS_INCLUDE_PATH=/home/farnaz/anaconda3/include/python3.6m

Woah! Magical! It worked! Thanks
For python 3.5 use
export CPLUS_INCLUDE_PATH=/usr/include/python3.5m

it worked for me! thx

Thanks @ghost!

@ghost worked for me. Thanks!

Hi ,

Can you please check this issue below

See this issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

greatgao picture greatgao  ·  3Comments

hawklucky picture hawklucky  ·  3Comments

lixin7895123 picture lixin7895123  ·  3Comments

FreakTheMighty picture FreakTheMighty  ·  3Comments

Ruhjkg picture Ruhjkg  ·  3Comments