Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot create virtualenv instance in python 2.7.5 because of pip installation error

I'm trying to follow the directions on the Flask installation website but I encountered an error after I used "sudo easy_install virtualenv" to install virtual environment. Not sure

Opals-MacBook-Pro:~ opalkale$ mkdir myproject
Opals-MacBook-Pro:~ opalkale$ cd myproject
Opals-MacBook-Pro:myproject opalkale$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools, pip...
  Complete output from command /Users/opalkale/myproject/venv/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 "/Library/Python/2.7/site-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 "/Library/Python/2.7/site-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 "/Library/Python/2.7/site-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 "/Library/Python/2.7/site-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 "/Library/Python/2.7/site-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 "/Library/Python/2.7/site-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 "/Library/Python/2.7/site-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 "/Library/Python/2.7/site-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 "/Library/Python/2.7/site-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: /Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/EGG-INFO/PKG-INFO is not a subpath of /Library/Python/2.7/site-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 8, in <module>
load_entry_point('virtualenv==1.11', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 820, in main
symlink=options.symlink)
  File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 988, in create_environment
install_wheel(to_install, py_executable, search_dirs)
  File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 956, in install_wheel
'PIP_NO_INDEX': '1'
  File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 898, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/opalkale/myproject/venv/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1
like image 378
Opal Avatar asked Jan 04 '14 04:01

Opal


People also ask

Does Python 2.7 support virtualenv?

Python and OS Compatibility. virtualenv works with the following Python interpreter implementations: CPython versions 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10.

How do I install Python 2.7 on Windows virtualenv?

I used the following commands in order C:\>python27\Scripts\pip.exe --version pip 8.1. 1 from c:\python27\lib\site-packages (python 2.7) C:\>python27\Scripts\pip.exe install virtualenv Collecting virtualenv and it prints nothing else.

How do I enable pip virtual env?

To create a virtual environment, go to your project's directory and run venv. If you are using Python 2, replace venv with virtualenv in the below commands. The second argument is the location to create the virtual environment. Generally, you can just create this in your project and call it env .


1 Answers

This is logged as an issue with the recently released virtualenv 1.11. I had similar issues on Windows with this release.

I believe installing virtualenv 1.10.1 will let you continue working until this issue is addressed.

like image 75
Miguel Avatar answered Oct 02 '22 19:10

Miguel