Issue #129 resolved

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

Ionel Maries Cristian
created an issue

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/

Comments (23)

  1. Marcus Smith

    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

  2. mbiber

    I have the problem also:

    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
    
  3. Marcus Smith

    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.

  4. Marcus Smith

    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...

  5. Ellis Percival

    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
    
  6. 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.

  7. Marcus Smith

    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.

  8. 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.

  9. apatrushev

    The problem still exists:

    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

  10. Marcus Smith

    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

  11. Log in to comment