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

Unable to find venv/lib/python2.7/config/Makefile #1074

Closed
dctrwatson opened this issue Jul 23, 2013 · 15 comments
Closed

Unable to find venv/lib/python2.7/config/Makefile #1074

dctrwatson opened this issue Jul 23, 2013 · 15 comments
Labels
auto-locked Outdated issues that have been locked by automation
Milestone

Comments

@dctrwatson
Copy link

Seems the path is getting mangled. It's supposed to be looking for /usr/local/myapp/venv/lib/python2.7/config/Makefile but is actually looking for /usr/myapp/venv/lib/python2.7/config/Makefile (dropping the local)

  • Ubuntu 12.04
  • Python 2.7.3
  • pip 1.4
  • virtualenv 1.7.1.2
Traceback (most recent call last):
  File "/usr/local/myapp/venv/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4', 'console_scripts', 'pip')()
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 2279, in load_entry_point
    return ep.load()
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1989, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/pip/__init__.py", line 11, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/pip/vcs/subversion.py", line 4, in <module>
    from pip.index import Link
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/pip/index.py", line 32, in <module>
    from pip.wheel import Wheel, wheel_ext, wheel_setuptools_support, setuptools_requirement
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/pip/wheel.py", line 18, in <module>
    from pip import pep425tags
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/pip/pep425tags.py", line 98, in <module>
    supported_tags = get_supported()
  File "/usr/local/myapp/venv/local/lib/python2.7/site-packages/pip/pep425tags.py", line 61, in get_supported
    soabi = sysconfig.get_config_var('SOABI')
  File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var
    return get_config_vars().get(name)
  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/myapp/venv/lib/python2.7/config/Makefile (No such file or directory)
@qwcode
Copy link
Contributor

qwcode commented Jul 23, 2013

cc @dholth maybe a corner case here, but a try/except around these sysconfig calls may be in order.
pip didn't cause this per se, but we're exposing it.

note that virtualenv patches sysconfig, but that patch logic has been static, even going back to v1.7 it seems.
https://github.com/pypa/virtualenv/commits/develop/virtualenv_embedded/distutils-init.py

maybe it's just a sysconfig bug, or a debian bug. not sure

@dholth
Copy link
Member

dholth commented Jul 23, 2013

That variable isn't even important/available until Python 3.3ish. You won't lose anything by guarding it.

There is a second use of sysconfig in that module but it's just to get the python version.

@qwcode
Copy link
Contributor

qwcode commented Jul 28, 2013

fixed in #1095

@benliles
Copy link

Not fixed in 1.4.1

@qwcode
Copy link
Contributor

qwcode commented Aug 12, 2013

@benliles trace? we added a catch for IOError with a test in 1.4.1.

@benliles
Copy link

Traceback (most recent call last):
File "/usr/local/mediacore/setup.py", line 124, in
**extra_arguments_for_setup
File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/mediacore/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 265, in init
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/usr/local/mediacore/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 289, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/usr/local/mediacore/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 618, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/usr/local/mediacore/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 862, in best_match
return self.obtain(req, installer) # try and download/install
File "/usr/local/mediacore/venv/local/lib/python2.7/site-packages/pkg_resources.py", line 874, in obtain
return installer(requirement)
File "/usr/local/mediacore/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 337, 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/mediacore/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 227, 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/mediacore/venv/lib/python2.7/config/Makefile (No such file or directory)

@qwcode
Copy link
Contributor

qwcode commented Aug 12, 2013

@benliles this is different. this is a trace from setuptools (not pip) related to prefix. it just happens to have the same resulting message. we can't catch and handle this in pip.

@dmckean
Copy link

dmckean commented Aug 17, 2013

Something in sysconfig in python 2.7 seems to be at fault. Try calling sysconfig.get_config_var('SOABI') a second time in pep425tags.py and entirely ignore the first call. The first call reports the error, the second call behaves normally.

Also reported in virtualenv's issue tracker: #118.

My fix:

    try:
        soabi = sysconfig.get_config_var('SOABI')
    except:
        pass
    try:
        soabi = sysconfig.get_config_var('SOABI')
    except IOError as e: # Issue #1074
        warnings.warn("{0}".format(e), RuntimeWarning)
        soabi = None

@nicksloan
Copy link

This issue is caused by a patch applied by Ubuntu that specifically replaced /usr/local with /usr in several functions. Line 63404 in https://launchpadlibrarian.net/151545955/python2.7_2.7.3-5ubuntu4.3.diff.gz.

This stinks of taking a shortcut to support Ubuntu's deviations from the typical posix_local schema. Annoying.

For future reference: moving your virtualenv out of /usr/local... will fix it.

@Neetuj
Copy link

Neetuj commented Apr 25, 2014

running into the same issue .. any pointers ?

root@njain2:/usr/local/horizon# pip --version
pip 1.5.4 from /usr/local/lib/python2.7/dist-packages (python 2.7)
root@njain2:/usr/local/horizon# python --version
Python 2.7.3
root@njain2:/usr/local/horizon# virtualenv --version
1.7.1.2

File "/usr/lib/python2.7/sysconfig.py", line 344, in _init_posix

raise IOError(msg)

IOError: invalid Python installation: unable to open /usr/horizon/.venv/lib/python2.7/config/Makefile (No such file or directory)


Cleaning up...
Command python setup.py egg_info failed with error code 1 in /usr/local/horizon/.venv/build/cryptography
Storing debug log for failure in /root/.pip/pip.log

@Neetuj
Copy link

Neetuj commented Apr 25, 2014

the file exists in /usr/local ..but i am not sure how to make it read from there .. and where exaclty it should be

root@njain2:/usr/local/horizon# ls /usr/horizon/.venv/lib/python2.7/config/Makefile
ls: cannot access /usr/horizon/.venv/lib/python2.7/config/Makefile: No such file or directory
root@njain2:/usr/local/horizon# ls /usr/local/horizon/.venv/lib/python2.7/config/Makefile
/usr/local/horizon/.venv/lib/python2.7/config/Makefile

@chadwhitacre
Copy link

Blech. Burned as well! I have a virtualenv at /usr/local/www, moving it up to /usr/www solves the problem.

@nicksloan Did you/someone report this with Ubuntu? Where is that so I can +1? :-)

@nicksloan
Copy link

@whit537 I thought I did, but I couldn't find it last time I looked.

@hannes-ucsc
Copy link

FWIW, I am only getting this on Ubuntu Precise, not on Lucid, Saucy, Trusty or Utopic.

Also, easy_install only prints error: None. Had to use pdb to find actual cause to be what's described here.

grosenbaum pushed a commit to grosenbaum/gcd-django-vagrant-install that referenced this issue Oct 13, 2015
natefoo added a commit to natefoo/pip that referenced this issue Oct 13, 2015
- Catch IOError wherever sysconfig is used (pypa#1074)
- Reapply pypa#2915

Also, be sure to normalize the SOABI
@ipmb
Copy link

ipmb commented Feb 9, 2016

For those looking for a quick and dirty solution without rebuilding the virtualenv in a new location, symlinking the virtualenv to the location where the file is missing (but continuing to use the one in /usr/local) worked around the issue for me.

kyleknap added a commit to kyleknap/aws-cli that referenced this issue Nov 21, 2016
The upgrade is needed due to the version of wheels pulled
in. When pulling in PyYAML as a dependency, PyYAML tries to
import a function from wheels that throws an IOError on
some patched Ubuntu versions. The issue is similar to:
pypa/pip#1074

Wheels has a fix or that bug and virtualenv
pulls that version of wheels in so it should no longer be an
issue.
kyleknap added a commit to kyleknap/aws-cli that referenced this issue Nov 21, 2016
The upgrade is needed due to the version of wheels pulled
in. When pulling in PyYAML as a dependency, PyYAML tries to
import a function from wheels that throws an IOError on
some patched Ubuntu versions. The issue is similar to:
pypa/pip#1074

Wheels has a fix or that bug and virtualenv
pulls that version of wheels in so it should no longer be an
issue.
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

10 participants