virtualenvwrapper installation fails on mac OSX Lion
Asked Answered
O

3

7

On Mac OSX 10.7.5 mkvirtualenv fails:

$ mkvirtualenv tmp
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: virtualenv==1.7.1.2

Installed virtualenv virtualenvwrapper with pip:

Downloading/unpacking virtualenv
  Downloading virtualenv-1.10.1.tar.gz (1.3MB): 1.3MB downloaded
  Running setup.py egg_info for package virtualenv

    warning: no files found matching '*.egg' under directory 'virtualenv_support'
    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
Downloading/unpacking virtualenvwrapper
  Downloading virtualenvwrapper-4.1.1.tar.gz (81kB): 81kB downloaded
  Running setup.py egg_info for package virtualenvwrapper

    Installed /private/tmp/pip_build_root/virtualenvwrapper/pbr-0.5.21-py2.7.egg
    [pbr] Processing SOURCES.txt
    warning: LocalManifestMaker: standard file '-c' not found

    warning: no files found matching 'AUTHORS'
    warning: no files found matching 'ChangeLog'
    warning: no previously-included files found matching '.gitignore'
    warning: no previously-included files found matching '.gitreview'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching '*.css' under directory 'docs'
    warning: no files found matching '*.js' under directory 'docs'
    warning: no files found matching '*.png' under directory 'docs'
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from virtualenvwrapper)
Installing collected packages: virtualenv, virtualenvwrapper
  Running setup.py install for virtualenv

    warning: no files found matching '*.egg' under directory 'virtualenv_support'
    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    Installing virtualenv script to /Library/Frameworks/Python.framework/Versions/2.7/bin
    Installing virtualenv-2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/bin
  Running setup.py install for virtualenvwrapper
    [pbr] Reusing existing SOURCES.txt
    changing mode of build/scripts-2.7/virtualenvwrapper.sh from 644 to 755
    changing mode of build/scripts-2.7/virtualenvwrapper_lazy.sh from 644 to 755
    Skipping installation of /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenvwrapper/__init__.py (namespace package)
    Installing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenvwrapper-4.1.1-py2.7-nspkg.pth
    changing mode of /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh to 755
    changing mode of /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper_lazy.sh to 755
Successfully installed virtualenv virtualenvwrapper
Cleaning up...

Installed and initialized the environment as per http://virtualenvwrapper.readthedocs.org/en/latest/install.html

$ export WORKON_HOME=$HOME/.virtualenvs
$ export PROJECT_HOME=$HOME/Devel
$ source /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh

Nevertheless, mkvirtualenv still fails as above. Help would be greatly appreciated.

Thanks Arthur

Orangy answered 8/9, 2013 at 14:47 Comment(2)
It looks like somehow you have an old version of the virtualenv command in /usr/local/bin. If you're running Python out of /Library/Framewors/Python.framework/Versions/2.7/bin, virtualenv should be in there. Now sure how you got it in /usr/local/bin but I would just delete that.Nudd
I had similar errors (OS X 10.9.1, virtualenv 1.11.1, pip 1.5.1) that went away of I installed virtualenv (and virtualenvwrapper) using pip --no-use-wheel .... I have no idea why.Fairly
V
16

Was getting this error on Mavericks OS X.

Traceback (most recent call last):
  File "/usr/local/bin/virtualenv-2.7", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Library/Python/2.7/site-packages/pkg_resources.py", line 2749, in <module>
    working_set = WorkingSet._build_master()
  File "/Library/Python/2.7/site-packages/pkg_resources.py", line 446, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/Library/Python/2.7/site-packages/pkg_resources.py", line 459, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/Library/Python/2.7/site-packages/pkg_resources.py", line 628, in resolve
    raise DistributionNotFound(req)

I had to remove a previous installation of virtualenv. So I removed the following

sudo rm /usr/local/bin/virtualenv
sudo rm /usr/local/bin/virtualenv-2.7

I found these paths via which command and and reloading my bash_profile. Then I uninstalled virtualenv via Pip.

sudo pip uninstall virtualenv

Lastly I reinstalled virtualenv via Pip.

sudo pip install virtualenv

Was then able to get things working

************:flask-ch8 cevaris$ virtualenv env
New python executable in env/bin/python
Installing setuptools, pip...done.
************:flask-ch8 cevaris$
Vanadium answered 10/3, 2014 at 0:48 Comment(0)
I
1

I fixed this problem erasing this 3 packages: 'easy_install', 'pip', and 'virtualenv' and then install everything from scratch.

Incur answered 8/12, 2013 at 18:38 Comment(1)
Very useful tip! Helped me a lot. I was having that problem on Amazon EC2. Actually, I think running pip install --upgrade setuptools as advised here was important too.Buxton
C
0

I had the same problem and found the solution on a Google group. It seems that /usr/local/bin/virtualenv was not updated so if you open it, you will see a reference to the old virtualenv 1.7.1.2 when a newer version has been installed on your system.

So you just need to open /usr/local/bin/virtualenv and replace it with:

#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from virtualenv import main

if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

And that does the trick!

Source: https://groups.google.com/forum/#!topic/python-virtualenv/hL_QDPJsnuY

Closet answered 19/7, 2014 at 11:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.