Ooo, I'm intrigued! But is it safe? (image from here) |
In my case, I had a pretty good feeling the upgrade from Snow Leopard to Mountain Lion would break many parts of the python scientific computing development environment running on my system. Fortunately, I was going take a hiatus from that kind of development for a while. When I finally picked it back up, everything was working fine, surprisingly! But then I needed to update Pandas and iPython...
My development environment was built using Homebrew and pip. It's got python, zeromq, numpy, scipy, matplotlib, cython, pandas, ipython, and qtconsole. If you are looking to create an the environment from scratch, check out this article. It's pretty good. At some point I'll write up what I did. This article focuses on updating your installation.
Happy Path to Updating
My particular installation has a few more packages installed. So, there are more updates that need to occur. Note that when doing some of the upgrades via pip, other upgrades may get automatically triggered. For instance, upgrading matplotlib will likely upgrade tornado; therefore, you would not need to do so explicitly.
01 brew update # update brew itself
02 brew upgrade # update all installed packages
03 pip list # list installed pip packages
04 pip install --upgrade numpy
05 pip install --upgrade scipy
06 pip install --upgrade matplotlib # will likely update tornado for you
07 pip install --upgrade cython
08 pip install --upgrade pandas
09 pip install --upgrade pyzmq
10 pip install --upgrade pygments
11 pip install --upgrade ipython # repeat 'til latest version is installed
12 pip list
13 ipython qtconsole # test ipython in the GUI
14 ipython # test ipython in the terminal
Errors Updating Homebrew
Or maybe you got some error stating that Your local changes to the following files would be overwritten by merge. See my post on Updating Homebrew Woes for tips on dealing with various issues. I am going to be brief here. The following commands should solve your Homebrew issues, and you can start on the happy path again.
01 brew doctorThe brew doctor command will tell you nearly everything that is wrong. Listen to the doctor and do what she says. The chown command will make sure you, the local user, owns the directory in which brew lives. The last three will reset your brew installation to the master branch (so, if you did actually make local changes, you may want to commit them).
02 sudo chown -R $(whoami) $(brew --prefix)
03 cd $(brew --prefix)
04 git fetch origin
05 git reset --hard origin/master
Errors Updating PIP Installed Packages
error: /usr/include/zlib.h: No such file or directory
➜ install/update Xcode and/or Command Line Tools for Xcode
src/_png.cpp:23:13: fatal error: 'png.h' file not found
➜ brew install libpng
various errors installing matplotlib
➜ brew install freetype
➜ brew install libpng
Nifty Tools
Unfortunately, pip does not have a similar command. However, Artur Siekielski wrote a script that can tell you what pip packages are up-to-date or have available updates. I have not used the script, but it could be handy.
References + Links
Installing Scientific Python on Mac OS X
Updating Homebrew Woes
Homebrew Troubleshooting
Homebrew FAQ
Script to Check for Package Updates on PyPi
http://pandas.pydata.org/
http://ipython.org/
http://brew.sh/
http://www.pip-installer.org
No comments:
Post a Comment