Fixing virtualenv after installing Mountain Lion

Filed under: Python | 11 Comments

After installing Mac OS X Mountain Lion you may find that your Python virtualenv setup has broken. I saw a traceback ending in “IOError: [Errno 2] No such file or directory: ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/__init__.py'”

Another error was being produced by virtualenvwrapper when trying to use the workon command: “ImportError: No module named virtualenvwrapper.hook_loader”

Fixing my virtualenv setup was pretty simple:

  1. Installed the XCode 4.4 Command Line Tools.
  2. Re-installed pip: sudo easy_install pip
  3. Re-installed virtualenv and virtualenvwrapper: sudo pip install virtualenv virtualenvwrapper

No other changes were needed and everything was running smoothly.

Read the latest posts

11 Responses to “Fixing virtualenv after installing Mountain Lion”

  1. James Robert says:

    have you tried creating new virtualenvs? That still doesn’t work for me

  2. It worked for me! Thanks for the help.

  3. Melpomene says:

    Thanks alot, saved my day.

  4. carpincho says:

    i only needed to install xcode4.4 command line tool.
    thanks!

  5. Kevin F says:

    Thanks a lot for this, worked like a charm!

  6. Andrew Jones says:

    Just installing the XCode Command Line Tools fixed this for me.

    Thanks!

  7. carsten says:

    Hi there,

    I reinstalled the command line tools for mountain lion, but it is still not working. Any more ideas?

    This happened after installing, pip, virtualenv and then virtualenvwrapper when it crashed.

    thanks for any help

  8. Joe says:

    Worked for me – thanks so much for posting!

  9. TJ says:

    wow 2 days to finally getting this working…thanks to you now Im past it. 😉

Leave a Reply to James Robert