Python 2.7 unable to find it's header files in virtualenv

Bug #839588 reported by Domen Kožar on 2011-09-02
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python2.7 (Ubuntu)
Medium
Barry Warsaw
Nominated for Precise by Robert Collins
Lucid
Undecided
Unassigned
Oneiric
Medium
Barry Warsaw

Bug Description

This bug breaks any C dependant code in virtualenv when using Python 2.7 and should be considered as serious issue. For example, it's impossible to install egenix-mx-base inside virtualenv-2.7

$ virtualenv --no-site-packages -p python2.6 test
$ cd test && bin/python2.7
import sysconfig
sysconfig.get_config_h_filename()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/sysconfig.py", line 397, in get_config_h_filename
    inc_dir = get_path('platinclude').replace("/usr/local","/usr",1)+(sys.pydebug and "_d" or "")
  File "/usr/lib/python2.7/sysconfig.py", line 426, in get_path
    return get_paths(scheme, vars, expand)[name]
  File "/usr/lib/python2.7/sysconfig.py", line 417, in get_paths
    return _expand_vars(scheme, vars)
  File "/usr/lib/python2.7/sysconfig.py", line 172, in _expand_vars
    _extend_dict(vars, get_config_vars())
  File "/usr/lib/python2.7/sysconfig.py", line 457, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 310, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /home/ielectric/code/test/local/lib/python2.7/config/Makefile (No such file or directory)

Domen Kožar (ielectric+) wrote :

Note that calling get_config_h_filename() again actually succeeds.

Changed in python2.7 (Ubuntu):
status: New → Confirmed
Barry Warsaw (barry) wrote :

It looks like this bug has been fixed in upstream 1.6.4. Rather than cherry pick the fix, I think it's better to just upgrade our version. I have a branch for this, which I'll push momentarily.

Changed in python2.7 (Ubuntu):
importance: Undecided → Medium
assignee: nobody → Barry Warsaw (barry)
milestone: none → ubuntu-11.10-beta-2
Domen Kožar (ielectric+) wrote :

Do you plan to backport to 11.04?

description: updated
Barry Warsaw (barry) on 2011-09-14
Changed in python2.7 (Ubuntu Oneiric):
status: Confirmed → Fix Committed
status: Fix Committed → Fix Released
James E. Blair (corvus) wrote :

This is a problem in Precise with projects that have a setup_requires.

root@bare-precise-hpcloud-b1-1:~# virtualenv /usr/local/zuul-env
New python executable in /usr/local/zuul-env/bin/python
Installing setuptools, pip...done.
root@bare-precise-hpcloud-b1-1:~# /usr/local/zuul-env/bin/pip install /tmp/zuul >local-log 2>&1

/usr/local/zuul-env/local/lib/python2.7/site-packages/pip/pep425tags.py:62: RuntimeWarning: invalid Python installation: unable to open /usr/zuul-env/lib/python2.7/config/Makefile (No such file or directory)
  warnings.warn("{0}".format(e), RuntimeWarning)
Unpacking /tmp/zuul
  Running setup.py (path:/tmp/pip-cLt2Eg-build/setup.py) egg_info for package from file:///tmp/zuul
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip-cLt2Eg-build/setup.py", line 22, in <module>
        pbr=True)
      File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/zuul-env/local/lib/python2.7/site-packages/setuptools/dist.py", line 260, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/usr/local/zuul-env/local/lib/python2.7/site-packages/setuptools/dist.py", line 285, in fetch_build_eggs
        replace_conflicting=True
      File "/usr/local/zuul-env/local/lib/python2.7/site-packages/pkg_resources.py", line 631, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/usr/local/zuul-env/local/lib/python2.7/site-packages/pkg_resources.py", line 871, in best_match
        return self.obtain(req, installer)
      File "/usr/local/zuul-env/local/lib/python2.7/site-packages/pkg_resources.py", line 883, in obtain
        return installer(requirement)
      File "/usr/local/zuul-env/local/lib/python2.7/site-packages/setuptools/dist.py", line 333, in fetch_build_egg
        cmd.ensure_finalized()
      File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/usr/local/zuul-env/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 212, in finalize_options
        prefix, exec_prefix = get_config_vars('prefix', 'exec_prefix')
      File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
        _init_posix(_CONFIG_VARS)
      File "/usr/lib/python2.7/sysconfig.py", line 344, in _init_posix
        raise IOError(msg)
    IOError: invalid Python installation: unable to open /usr/zuul-env/lib/python2.7/config/Makefile (No such file or directory)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers