Skip to end of metadata
Go to start of metadata
This page provides hints for fixing issues with Python and virtualenv on Macs.

Virtualenv was updated late 2013 and it now installs differently than before. Brew also has a different way of installing Python into the system. Older Mac installations may at some point run into issues such as the ones described below. The steps described below may provide help to get to a working system again. (Stuff was tested with MacOX 10.8 and may be different for older or newer versions)

As always, running a "brew doctor" is a good indicator for any issues. You may need a current XCode and installed XCode command line tools. See the New Developer Tutorial for detailed descriptions of the installation steps.

For other common errors and troubleshooting, please see here: [CIDev:Troubleshooting the developer environment]

Detailed Steps

Update brew

The following is always recommended to find any issues with brew related system installations, which includes Python and other core dependencies.

For more details about some fixes, see below.

Clean Python search path

Make sure "/usr/local/share/python" is not in the system search path anymore when executing "echo $PATH". The following line in .profile or .bashrc works fine:

Of course, exit any shell/terminal windows and reopen for these changes to take effect.

Clean Brew Python

Make sure the right Python interpreter is found as default python:

If any of this does not match (the python revision can be anything 2.7.3 or higher), please uninstall python via brew and reinstall via brew as described in the New Developer Tutorial.

Clean older brew Python artifacts

Make sure the directory "/usr/local/share/python" only contains Extras symlink. Delete all other directories and files from this directory. This includes all virtualenv related files. These are from older virtualenv installations. Please follow instructions below to upgrade virtualenv.

Clean Python site-packages

Check installations for the system wide site-packages:

Here some example dependencies and versions that work (not necessarily correct or all needed):

Clean Virtualenv install

The following lines in .profile or .bashrc are the only ones required.

Remove all entries such as:

You may have to recreate all code virtualenvs after updating.

Virtualenv/buildout problems

When starting the pycc capability container and you run into problems such as:

but the referenced code is actually there (in this case ion/services/dm/inventory/ but it can be a different service), there is something wrong with the virtualenv/buildout installation. Please recreate a new virtualenv and do a fresh buildout. This should solve the situation.

ImportError: cannot import name MAXREPEAT

If you get an error like this:

you likely have an incompatible version of Python. It seems Pyton 2.7.4 introduced breaking changes, fixed with higher versions.

After this you may have to rebuild your virtualenvs, because they replicate some parts of the python installation inside. Delete them with rmvirtualenv and recreate them as documented in the README.


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.