If you are a python developer and have recently updated to the new OS X Mavericks, you might be getting a series of new error messages. Here are a few steps that may help you fix some of the problems that have come from the new update.
However, before you begin make sure you have updated to the latest version of the operating system, as well as Xcode Command Line Tools.
You can install the Xcode Command Line tools directly from the CLI:
$ xcode-select --install
The very first problem after upgrading was a
exception being through by pip. Since I have my terminal setup to use ZSH, it
attempts to source
virtualenvwrapper.sh on startup. When launching iTerm, I
was immediately shown the following:
Traceback (most recent call last): File "/usr/local/bin/pip", line 5, in 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 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
The error message was a little unhelpful, and some of the Google search results
were either outdated or incomplete. However, I was able to put together a few
pieces of information on my Twitter feed from other developers encountering the
same problem. My actual problem was that my machine's installation of
distribute was outdated. The following commands download
ez_setup securely and update your installation:
$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py $ sudo python ez_setup.py
After fixing the original problem around distribution error message, I
encountered another problem with
/usr/bin/python: No module named virtualenvwrapper virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenv has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.
This one actually turned out to be an easy fix. I just needed to force a
virtualenvwrapper with the following:
$ sudo easy_install pip $ sudo pip install --upgrade virtualenvwrapper