Caffe: fatal error: pyconfig.h: No such file or directory

Created on 11 Jun 2014  Â·  14Comments  Â·  Source: BVLC/caffe

Dear all,

if I clone the latest version of caffe from github and run 'make pycaffe', I get the following error:

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

I put the python subdirectory in my PYTHONPATH. This is a copy of https://github.com/BVLC/caffe/issues/410, which still persists. Any help would be appreciated.

Best,
Philipp.

Most helpful comment

This work for me (source):

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

All 14 comments

Are the appropriate headers and libraries installed for Python development on your system? Are they accessible from the paths defined by PYTHON_INCLUDES and PYTHON_LIB in Makefile.config?

(By the way, why don't we use python-config for setting those variables automatically?)

@longjon I think we don't automatically configure python in case of
multiple python installs and/or users who have a system python but really
would have a better life with Anaconda and so on.

Le mardi 10 juin 2014, longjon [email protected] a écrit :

Are the appropriate headers and libraries installed for Python development
on your system? Are they accessible from the paths defined by
PYTHON_INCLUDES and PYTHON_LIB in Makefile.config?

(By the way, why don't we use python-config for setting those variables
automatically?)

—
Reply to this email directly or view it on GitHub
https://github.com/BVLC/caffe/issues/489#issuecomment-45698548.

Evan Shelhamer

@shelhamer that's sensible enough, although surely the user's PATH should contain the desired python, and therefore the desired python-config? (Otherwise things are likely to go poorly when the user launches python and imports pycaffe built against a different Python, as we've seen happen before.)

In any case building against Anaconda explicitly is a commented option in Makefile.config.example, the question is just what the default should be.

Thank you for your help, adding
/usr/include/python2.7/
to the PYTHON_INCLUDE list in Makefile.config did the trick.

Specifying the correct anaconda location fixed this for me. See pull request #1296. So I changed ANACONDA_HOME to /anaconda.

This work for me (source):

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

I also meet this problem... and try to close it.

Thanks @adam-erickson it worked for me too.

@adam-erickson how and where should I run/put those lines in your comments? I'm quite new on Ubuntu so I need more details on this.

@adam-erickson Thanks!!!

@adam-erickson Thank you so much!

Thanks this helped me too

export CPLUS_INCLUDE_PATH=/usr/include/python2.7

That's work for me! Thanks

changing the gcc version resolved my error. I configured to gcc6 from gcc7. https://medium.com/@atinesh/ubuntu-tips-and-tricks-configuring-multiple-gcc-in-same-ubuntu-machine-a391a34d79c2

Was this page helpful?
0 / 5 - 0 ratings