Fatal error : pyconfig.h.

2,570 views
Skip to first unread message

Styvane S

unread,
Mar 11, 2014, 5:38:04 AM3/11/14
to cython...@googlegroups.com
Hi,

How to fix fatal error fatal error: pyconfig.h: No such file or directory.
 #include "pyconfig.h" while compiling 'c' generated  file using
cython <filename.pyx>
Cython version 0.20.1
gcc-4.8

Thanks

Stefan Behnel

unread,
Mar 11, 2014, 5:45:58 AM3/11/14
to cython...@googlegroups.com
Styvane S, 11.03.2014 10:38:
Did you get a second error telling you that "Python.h" could not be found?
In that case, you need to install the Python development package (as that
error message would have told you).

This might have become a little less obvious in Cython 0.20 because it
looks for pyconfig.h before Python.h ...

Stefan

Stefan Behnel

unread,
Mar 16, 2014, 12:14:57 PM3/16/14
to cython...@googlegroups.com
Stefan Behnel, 11.03.2014 10:45:
Hmm, actually, no - it still #includes all header files and only then
checks for the Python version, so nothing really changed here, except that
the first header file it prints as an error is a different one. The final
error message should still be just as clear as before.

Stefan

Ron Johnson

unread,
Jun 30, 2014, 11:38:43 AM6/30/14
to cython...@googlegroups.com

I get the same error, even though python2.7-dev is installed.

$ cython --version
Cython version 0.19

$ cython sieve3.pyx
$ ls -aFl sieve3.c

-rw-r--r-- 1 ron ron 133085 Jun 30 10:34 sieve3.c

$ gcc sieve3.c
sieve3.c:8:22: fatal error: pyconfig.h: No such file or directory
 #include "pyconfig.h"
                      ^
compilation terminated.

Stefan Behnel

unread,
Jun 30, 2014, 1:20:30 PM6/30/14
to cython...@googlegroups.com
Ron Johnson, 30.06.2014 17:38:
> I get the same error, even though python2.7-dev is installed.
>
> $ cython --version
> Cython version 0.19
>
> $ cython sieve3.pyx
> $ ls -aFl sieve3.c
>
> -rw-r--r-- 1 ron ron 133085 Jun 30 10:34 sieve3.c
>
> $ gcc sieve3.c
> sieve3.c:8:22: fatal error: pyconfig.h: No such file or directory
> #include "pyconfig.h"
> ^
> compilation terminated.

You're missing lots of compilation options for your gcc call:

http://docs.cython.org/src/reference/compilation.html#compiling-from-the-command-line

Stefan

Chris Barker

unread,
Jun 30, 2014, 4:51:52 PM6/30/14
to cython-users
On Mon, Jun 30, 2014 at 10:20 AM, Stefan Behnel <stef...@behnel.de> wrote:
 
> $ gcc sieve3.c
> sieve3.c:8:22: fatal error: pyconfig.h: No such file or directory
>  #include "pyconfig.h"
 
You're missing lots of compilation options for your gcc call:

you probably want to use distutils (setup.py) to compile -- trust me on this!


-CHB
 


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
0 new messages