Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

venv assumes header files in sys._home + '/Include' #59571

Closed
sbt mannequin opened this issue Jul 16, 2012 · 8 comments
Closed

venv assumes header files in sys._home + '/Include' #59571

sbt mannequin opened this issue Jul 16, 2012 · 8 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@sbt
Copy link
Mannequin

sbt mannequin commented Jul 16, 2012

BPO 15366
Nosy @vsajip, @vstinner
PRs
  • bpo-30273: update distutils.sysconfig #1515
  • [3.6] bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) #1625
  • [3.5] bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) #1626
  • Files
  • distutils-sysconfig.patch
  • distutils-sysconfig.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-07-16.17:25:07.283>
    created_at = <Date 2012-07-16.11:30:11.073>
    labels = ['type-bug', 'library']
    title = "venv assumes header files in sys._home + '/Include'"
    updated_at = <Date 2017-05-17.00:59:26.422>
    user = 'https://bugs.python.org/sbt'

    bugs.python.org fields:

    activity = <Date 2017-05-17.00:59:26.422>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-07-16.17:25:07.283>
    closer = 'python-dev'
    components = ['Library (Lib)']
    creation = <Date 2012-07-16.11:30:11.073>
    creator = 'sbt'
    dependencies = []
    files = ['26397', '26399']
    hgrepos = []
    issue_num = 15366
    keywords = ['patch']
    message_count = 8.0
    messages = ['165589', '165598', '165624', '165642', '293301', '293322', '293833', '293835']
    nosy_count = 4.0
    nosy_names = ['vinay.sajip', 'vstinner', 'python-dev', 'sbt']
    pr_nums = ['1515', '1625', '1626']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue15366'
    versions = ['Python 3.3']

    @sbt
    Copy link
    Mannequin Author

    sbt mannequin commented Jul 16, 2012

    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.

    @sbt sbt mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 16, 2012
    @sbt
    Copy link
    Mannequin Author

    sbt mannequin commented Jul 16, 2012

    The attached patch seems to fix the problem.

    @sbt
    Copy link
    Mannequin Author

    sbt mannequin commented Jul 16, 2012

    Updated patch. Old one broke test_distutils...

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 16, 2012

    New changeset 998c8a8f2aea by Vinay Sajip in branch 'default':
    Closes bpo-15366: Corrected computation of include location for source builds. Thanks to Richard Oudkerk for the bug report and patch.
    http://hg.python.org/cpython/rev/998c8a8f2aea

    @python-dev python-dev mannequin closed this as completed Jul 16, 2012
    @vstinner
    Copy link
    Member

    vstinner commented May 9, 2017

    I reverted the commit in 2.7, 3.5, 3.6 and master (3.7) branches to fix bpo-30273, but I'm unable to reproduce this bug so it seems like venv and virtualend have been updated in the meanwhile to add ${venv}/include to the include directories.

    See for example the commit ab6b962.

    @vstinner
    Copy link
    Member

    vstinner commented May 9, 2017

    New changeset dbdea62 by Victor Stinner (Jeremy Kloth) in branch 'master':
    bpo-30273: update distutils.sysconfig for venv's created from Python (bpo-1515)
    dbdea62

    @vstinner
    Copy link
    Member

    New changeset 460945f by Victor Stinner in branch '3.6':
    bpo-30273: update distutils.sysconfig for venv's created from Python (bpo-1515) (bpo-1625)
    460945f

    @vstinner
    Copy link
    Member

    New changeset f01c0ec by Victor Stinner in branch '3.5':
    bpo-30273: update distutils.sysconfig for venv's created from Python (bpo-1515) (bpo-1626)
    f01c0ec

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant