MacOS – Upgrade to Mavericks wipes out Python site-packages directory

macospython

As the subject suggests, I recently upgraded to OSX Mavericks, and…

$ ls /Library/Python/*/site-packages/
/Library/Python/2.3/site-packages/:
Extras.pth README

/Library/Python/2.5/site-packages/:
README

/Library/Python/2.6/site-packages/:
README

/Library/Python/2.7/site-packages/:
README 

I had a bunch of modules installed there, mostly Django stuff and dependencies thereof under 2.7, and now it seems to all be… just gone. And no, the READMEs don't say anything helpful.

So, questions:

  1. Has anyone else seen this? I can't find any other mentions of it online, so… maybe there's something else going on?
  2. Any suggestions for things I should do or investigate before I just start re-installing it all while cursing quietly to myself?

Best Answer

Apple tends to wipe out supporting files for scripting languages such as python, perl, and ruby with each major upgrade.

To avoid this in the future, look for a package manager that maintains and works with a local copy of python outside of the Apple managed folders of /Library and /System. A good starting point is homebrew:

Install homebrew with:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Then install a local copy of python with:

brew install python

For perl, the perlbrew project is ideal and explicitly calls out Apple for his behaviour.