views:

101

answers:

1

I've been using virtualenv + pip for python development. I'm not sure what happened, but suddenly whenever I try to run a command-line tool or import libraries, I get this error message:

Traceback (most recent call last):
  File "/Users/kyle/.virtualenvs/fj/bin/pip", line 4, in <module>
    import pkg_resources
  File "/Users/kyle/.virtualenvs/fj/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 698, in <module>
    the platform/python version defined at initialization are added.
  File "/Users/kyle/.virtualenvs/fj/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 701, in Environment
    search_path = sys.path
  File "/Users/kyle/.virtualenvs/fj/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 96, in get_supported_platform
    'Environment', 'WorkingSet', 'ResourceManager',
  File "/Users/kyle/.virtualenvs/fj/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 221, in get_build_platform
    if provDarwin:
  File "/Users/kyle/.virtualenvs/fj/lib/python2.6/distutils/__init__.py", line 14, in <module>
    exec open(os.path.join(distutils_path, '__init__.py')).read()
IOError: [Errno 2] No such file or directory: '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/__init__.py'

From what I can decipher, Python is trying to find distutils_path in the Mac OSX system version Python, not my virtualenv version like it should be.

Not sure why this suddenly started happening. Maybe a recent OSX update? Another possibility is that my hard drive was about to die, so Apple gave me a new one and ran Migration Assistant. Maybe something didn't transferred across correctly?

A: 

Turns out the problem was that Migration Assistant, for whatever reason, didn't copy over tools like gcc -- I reinstalled Xcode and things work properly again.

Kyle Fox
Migration Assistant's job is to migrate *user accounts*, not the whole OS and associated software.
EOL