1

I have been hacking away at getting packages to work in my initial coding stages. I only recently stumbled upon virtualenv and found the need to install Python using Homebrew.

I have installed Homebrew and Python using it and pip is working. All my executables appear to be in the correct location and they are in the PATH. So when I load python from the terminal I get version 2.7.6 (not the standard 2.7.5).

The issue is that I have added so many packages and things to the standard installation that it is causing hassles. For example, when I try to create a virtualenv, there is a traceback error as such:

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

The virtualenv version I have is 1.11.x. It is clearly looking for packages in /System/Library/... which is the preinstalled python location.

Is there a way to clean the pre-installation of Python on a Mac. In other words, can I restore it to stock as it was when the Mac was first turned on?

2 Answers 2

2

Upgrading with easy_install resolved this same issue for me:

# easy_install --upgrade virtualenv
1
  • That didn't work but somehow after massing around with soft links and the like I managed to restore everything to the way I needed it. If only I knew what I could give a clear answer to this.
    – bteres
    Jul 1, 2014 at 15:10
-1

Use the Mac install image/disc & shareware 'Pacifist' - well worth the $20 registration fee.

You can download the appropriate image from the Mac App Store, for recent versions of OS X.

If Pacifist cannot find the installation image (in my case, with 10.9 Installer mounted), then you may need to inspect the 'package contents' and mount the internal disk image of the OS X installer (typically about 5GB). Then Pacifist will find the required files.

Tip: Use the Pacifist menu to 'Restore to original location' rather than the UI buttons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.