[New-bugs-announce] [issue15366] venv assumes header files in sys._home + '/Include'

Richard Oudkerk report at bugs.python.org
Mon Jul 16 13:30:11 CEST 2012


New submission from Richard Oudkerk <shibturn at gmail.com>:

For Unix I follow the practice suggested in README of running configure from a subdir of the main python directory, eg

    mkdir release
    cd release
    ../configure
    make

But if I create a venv then I cannot use it to compile C extensions because the include dirs are wrong, eg

    running build
    running build_ext
    building 'demo' extension
    gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/user/Repos/cpython/release/Include -I/home/user/Repos/cpython/release -c demo.c -o build/temp.linux-i686-3.3/demo.o
    demo.c:1:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1

The problem seems to be that distutils.sysconfig.get_python_inc() assumes that if sys._home is set (as it is in a virtual env) then the standard header files can be found in sys._home + '/Include'.

But for my venv this is wrong, since sys._home is "/home/user/Repos/cpython/release" and "/home/user/Repos/cpython/release/Include" is empty.  Instead get_python_inc() should return "/home/user/Repos/cpython/Include".

BTW, a seperate issue seems to be that ${venv}/include is not added to the list of include dirs used when compiling.

----------
components: Library (Lib)
messages: 165589
nosy: sbt, vinay.sajip
priority: normal
severity: normal
stage: needs patch
status: open
title: venv assumes header files in sys._home + '/Include'
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15366>
_______________________________________


More information about the New-bugs-announce mailing list