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

AssertionError: EGG-INFO/PKG-INFO is not a subpath ... #129

Closed
ghost opened this issue Jan 4, 2014 · 23 comments
Closed

AssertionError: EGG-INFO/PKG-INFO is not a subpath ... #129

ghost opened this issue Jan 4, 2014 · 23 comments

Comments

@ghost
Copy link

ghost commented Jan 4, 2014

Originally reported by: ionelmc (Bitbucket: ionelmc, GitHub: ionelmc)


With the latest virtualenv I get this:

virtualenv .ve --python=/usr/bin/python2.7 --system-site-packages
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in .ve/bin/python2.7
Also creating executable in .ve/bin/python
Installing setuptools, pip...
  Complete output from command /home/nestea/deploye...f6/.ve/bin/python2.7 -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip:
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/__init__.py", line 9, in <module>
    # See the README file for information on usage and redistribution.
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/log.py", line 8, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 2696, in <module>
    # Prepare the master working set and make the ``require()`` API available
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 429, in __init__
    self.callbacks = []
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 443, in add_entry
    always appended to ``.entries``, even if it is already present.
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1722, in find_in_zip
    """Yield distributions accessible on a sys.path directory"""
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1298, in has_metadata

  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1614, in _has

  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1488, in _zipinfo_name

AssertionError: /usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/EGG-INFO/PKG-INFO is not a subpath of /usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/


@ghost
Copy link
Author

ghost commented Jan 4, 2014

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


@qwcode: What do you make of this error? Is there something wrong with the setuptools wheel, or pkg_resources, or one of the other packages?

@ghost
Copy link
Author

ghost commented Jan 4, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


the associated virtualenv issue is pypa/virtualenv#524

@pmoore suspects it's a bug with the assertion in _zipinfo_name. I'm not sure at the moment.

this virtualenv release is very different in that it's adding 2 whl/zip files (for setuptools and pip) to the pythonpath, and then using pip to do the pip/setuptools install from wheels

@ghost
Copy link
Author

ghost commented Jan 4, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


it's only an issue when virtualenv is installed using easy_install (or python setup.py install)

@ghost
Copy link
Author

ghost commented Jan 5, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


to recreate easily outside of virtualenv, just add a pip or setuptools wheel file to your pythonpath, and then import pkg_resources

EDITED: this is not generally true, it's only true if you add the pip or setuptools wheel as installed in the virtualenv Egg

@ghost
Copy link
Author

ghost commented Jan 5, 2014

Original comment by mbiber (Bitbucket: mbiber, GitHub: mbiber):


I have the problem also:

#!bash
mbiber@MintLTS ~/Programming/Python/Django/test $ virtualenv test
New python executable in test/bin/python
Installing setuptools, pip...
  Complete output from command /home/marin/Programm...test/test/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip:
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/__init__.py", line 9, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/log.py", line 8, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 2696, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 429, in __init__
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 443, in add_entry
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1722, in find_in_zip
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1298, in has_metadata
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1614, in _has
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1488, in _zipinfo_name
AssertionError: /usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/EGG-INFO/PKG-INFO is not a subpath of /usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.11', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 820, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 988, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 956, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 898, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/marin/Programm...test/test/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1

@ghost
Copy link
Author

ghost commented Jan 5, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


what's happening:

  • it's trying to add the setuptools whl/zip to the working set
  • it checking for 'PKG-INFO' in the zip
  • it ends up constructing the zip path using the virtualenv egg root (which contains the setuptools wheel), and not the setuptools whl file as the root

still trying to sort out where exactly it goes wrong.

@ghost
Copy link
Author

ghost commented Jan 5, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


ok, I have a fix locally, that seems ok.

the problematic code is here: https://bitbucket.org/pypa/setuptools/src/735202ca6848d58bc59022f85cde10af64a61a7e/pkg_resources.py?at=default#cl-1383

this is what incorrectly constructs the path using the wrong root.

my fix is to override _setup_prefix in the ZipProvider to just pass.

If I can figure out PRs in bitbucket, maybe I'll log it.

@ghost
Copy link
Author

ghost commented Jan 5, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


overriding _setup_prefix to just pass is too aggressive.
trying to sort out what the best fix would be that's not just a hack, which means actually understanding pkg_resources internals...

@ghost
Copy link
Author

ghost commented Jan 5, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


opened PR https://bitbucket.org/pypa/setuptools/pull-request/32

@ghost
Copy link
Author

ghost commented Jan 6, 2014

Original comment by flyte (Bitbucket: flyte, GitHub: flyte):


Is this the same issue I'm having? It's caused by installing virtualenv with easy_install instead of pip, but gives a different traceback:

vagrant@precise64:~$ virtualenv ve
New python executable in ve/bin/python
Installing setuptools, pip...
  Complete output from command /home/vagrant/ve/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip:
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/__init__.py", line 9, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/log.py", line 8, in <module>
ImportError: No module named pkg_resources
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.11', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 820, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 988, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 956, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 898, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/vagrant/ve/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1

Happens with the following versions

pip 1.5 from /usr/local/lib/python2.7/dist-packages/pip-1.5-py2.7.egg (python 2.7)
setuptools 2.0.2
virtualenv 1.11

@ghost
Copy link
Author

ghost commented Jan 6, 2014

Original comment by swamy_dkv (Bitbucket: swamy_dkv, GitHub: Unknown):


I have also observed the same with the following packages.

python3.3,
pip-1.5,
ditribute-0.7.3,
virtualenv-1.11.

I have posted the error in Askubuntu and launchpad as well the links are given below.

Trying to create a python virtual environment but getting OSError

Trying to create a python virtual environment but getting OSError

@ghost
Copy link
Author

ghost commented Jan 7, 2014

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Merged in qwcode/setuptools/zip_path (pull request #32)

convert "find_in_zip" into "find_eggs_in_zip" to prevent it from walking whl files. Fixes #129

@ghost
Copy link
Author

ghost commented Jan 7, 2014

Original comment by flyte (Bitbucket: flyte, GitHub: flyte):


@qwcode, @jaraco

Thanks for fixing this.

I don't mean to rush you, but can you estimate how long before this fix is on pypi? I need to weigh up whether it's worth me writing workarounds into our deployment scripts or if I should just wait until this is released.

@ghost
Copy link
Author

ghost commented Jan 7, 2014

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Expect a release today. I'm on travel or I would have released already.

@ghost
Copy link
Author

ghost commented Jan 7, 2014

Original comment by flyte (Bitbucket: flyte, GitHub: flyte):


No probs. Thanks again.

@ghost
Copy link
Author

ghost commented Jan 13, 2014

Original comment by mdboom (Bitbucket: mdboom, GitHub: mdboom):


Is there going to be a new release of virtualenv to fix this?

I realize the fix itself is in setuptools here: https://bitbucket.org/pypa/setuptools/pull-request/32/convert-find_in_zip-into-find_eggs_in_zip/diff

but virtualenv 1.11 still includes the setuptools 2.0.1 wheel which doesn't contain the fix.

@ghost
Copy link
Author

ghost commented Jan 13, 2014

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


I believe 1.11.1 is in RC and will be released soon. You might get a more detailed answer by inquiring on the virtualenv ticket linked above.

@ghost
Copy link
Author

ghost commented Jan 13, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


yes, 1.11.1 will include setuptools 2.1. it should be released in the next few days or sooner.

@ghost
Copy link
Author

ghost commented Jan 17, 2014

Original comment by adeslat (Bitbucket: adeslat, GitHub: adeslat):


I also have this error -- and sorry I am just wondering the work around is so that i can use the tools? I understand it is fixed but do not know what I should do to have this work.

@ghost
Copy link
Author

ghost commented Jan 17, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


the immediate work around is to not install virtualenv with easy_install, but rather pip. but virtualenv-1.11.1 should be out in a day or so, and that will work in any install scenario.

@ghost
Copy link
Author

ghost commented Jan 18, 2014

Original comment by adeslat (Bitbucket: adeslat, GitHub: adeslat):


Great -- the following steps worked fine -- which implicitly set up the pip install -- sorry not a python maven....Note for other novices, 'myenv' is a string I add and the local install happens in a subdirectory created with the same name here.

>virtualenv --system-site-packages myenv

###>virtualenv myvirtualenv###
###>source myvirtualenv//bin/activate####

This worked for me. Thanks.

@ghost
Copy link
Author

ghost commented Jan 24, 2014

Original comment by apatrushev (Bitbucket: apatrushev, GitHub: apatrushev):


The problem still exists:

#!shell

AssertionError: /usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/EGG-INFO/PKG-INFO is not a subpath of /usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/setuptools-2.1-py2.py3-none-any.whl/

python 2.7
virtualenv 1.11.1
setuptools-2.1

@ghost
Copy link
Author

ghost commented Jan 24, 2014

Original comment by qwcode (Bitbucket: qwcode, GitHub: qwcode):


yes, unfortunately, we fixed the bug in setuptools' pkg_resources, but not in the vendored copy that pip now bundles inside itself (as of pip-1.5.1).

pip-1.5.2 and virtualenv-1.11.2 will contain that fix

@ghost ghost added major bug labels Mar 29, 2016
@ghost ghost closed this as completed Mar 29, 2016
@ghost ghost mentioned this issue Mar 29, 2016
jaraco added a commit that referenced this issue Mar 29, 2016
convert "find_in_zip" into "find_eggs_in_zip" to prevent it from walking whl files. Fixes #129
jaraco added a commit that referenced this issue Mar 27, 2022
In build_scripts, open scripts as text.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants