5

I've upgraded to Yosemite and this seems to have broken my python modules.

python --version == Python 2.7.6

Then from the Python shell:

>>> import pyrax
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/pyrax/__init__.py", line 38, in <module>
    import six.moves.configparser as ConfigParser
ImportError: No module named configparser

So its complaining about configparser.

pip show configparser
---
Name: configparser
Version: 3.3.0r2
Location: /Library/Python/2.7/site-packages
Requires: 

But it is there. After some reading it seems clear that ConfigParser has been renamed to configparser in python version 3. I am however running 2.7.

--- EDIT ----

Some more info:
I'm not using homebrew for Python
I've tried re-installing pyrax

Any ideas ?

Jason Prawn
  • 1,003
  • 11
  • 20
  • I also had broken packages when upgrading from Mountain Lion to Mavericks. If I remember right, I had to reinstall almost all 3rd party packages (mostly via `pip`) to get them to work again. Because of your question, I am now wondering exactly when Apple will get this whole upgrading thing working smoothly. – mach Oct 21 '14 at 13:18
  • Running out of options I decided to give this a go: http://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip . Unfortunately no luck there. – Jason Prawn Oct 22 '14 at 09:24

2 Answers2

9

Just move the old six out of the way, and reinstall via pip...

mkdir ~/six-old-library/
mkdir ~/six-old-system-library/
sudo mv /Library/Python/2.7/site-packages/six* ~/six-old-library/
sudo mv /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six* ~/six-old-system-library/
sudo pip install six
2

I had the same problem and spent a couple of hours investigating it.
I learned that the default python for OS X 10.10 contains an outdated six package.

This is how I fixed it:

  1. Install the python package from homebrew:

    brew install python
    

    Make sure that homebrew python is your default system version. Check brew doctor and your default $PATH:

    brew doctor
    

    Should say "Your system is ready to brew." If it doesn't, you need to fix it first. We need to use homebrew's python, not OS X's python:

    which python
    

    Should output and point to "/usr/local/bin/python"

    If it doesn't, check your $PATH - it should output "/usr/local/bin" first, then "/usr/bin". If it doesn't, update it in .bash_profile and/or .zshrc.

  2. Uninstall all your python packages:

    pip freeze | grep -v "^-e" | xargs pip uninstall -y
    
  3. Reinstall all your python packages as needed:

    pip install -r requirements.txt
    

After all that, it should work.

mskfisher
  • 3,291
  • 4
  • 35
  • 48