Intentando crear un entorno virtual de Python pero obteniendo OSError

7

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

Estoy dando el siguiente comando para crear un entorno virtual

virtualenv --no-site-packages test

Estoy teniendo el siguiente error

name@server:~/py_virenv$ virtualenv --no-site-packages test
Using base prefix '/usr/local'
New python executable in test/bin/python3
Not overwriting existing python script test/bin/python (you must use test/bin/python3)
Installing setuptools, pip...
  Complete output from command /home/swamydkv/py_virenv/test/bin/python3 -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip:
  Traceback (most recent call last):    
  File "<string>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/__init__.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/log.py", line 8, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 2696, in <module>
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 429, in __init__
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 443, in add_entry
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.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/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1298, in has_metadata
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1614, in _has
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1488, in _zipinfo_name
AssertionError: /usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/EGG-INFO/PKG-INFO is not a subpath of /usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.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/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv.py", line 820, in main
    symlink=options.symlink)
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv.py", line 988, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv.py", line 956, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/usr/local/lib/python3.3/site-packages/virtualenv-1.11-py3.3.egg/virtualenv.py", line 898, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/swamydkv/py_virenv/test/bin/python3 -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1
name@server:~/py_virenv$ 

Por favor, ayúdame a resolver esto.

swamydkv
fuente
Revisé el pip que está funcionando. Pero el pip no funciona con virtualenv
swamydkv

Respuestas:

6

Esto se debe a un error en las herramientas de configuración . Se ha solucionado en v2.1.

De lo contrario, la solución es instalar el último virtualenv (1.11) usando pip, o usar virtualenv 1.10.1:

Primero, desinstale virtualenv:

pip uninstall virtualenv

Es posible que deba ejecutar esto dos veces (por alguna razón desconocida) para desinstalarlo realmente. Luego instale usando pip o easy_install:

pip install virtualenv

o

easy_install "virtualenv<1.11"

Es posible que necesite sudo para ejecutar estos comandos.

Ellis Percival
fuente
3
Para su información, esto me ayudó a resolver el mismo problema con MAC OS X.
MARTIN Damien