Skip to content

Instantly share code, notes, and snippets.

@ches
Created January 9, 2011 03:34
Show Gist options
  • Save ches/771394 to your computer and use it in GitHub Desktop.
Save ches/771394 to your computer and use it in GitHub Desktop.

SciPy, PyQt and Matplotlib on OS X Snow Leopard

The squeeky-clean way with homebrew and pip/virtualenv.

$ easy_install pip
$ pip install virtualenvwrapper mercurial
$ brew install gfortran && brew install pyqt
# Have a nice long coffee break -- compiling Qt took 67 minutes on my
# quad-core i7 MBP, PyQt another 8.
$ brew test pyqt

$ export WORKON_HOME=$HOME/.virtualenvs
$ source /usr/local/bin/virtualenvwrapper.sh
$ export PIP_VIRTUALENV_BASE=$WORKON_HOME
$ export PIP_RESPECT_VIRTUALENV=true
$ mkvirtualenv --no-site-packages scipy

# Ugh. http://xrl.us/bid7jm
# You can skip this if you're using Homebrew-installed Python -- it depends on and compiles against proper GNU readline
$ easy_install readline
$ pip install ipython numpy scipy nose==0.11
# Have another coffee...

# another pip issue, assure latest version -- http://xrl.us/bid7iv
$ pip install -f http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz matplotlib
$ ipython -pylab

# Test things in the REPL, run a cute matplotlib plotting example
>>> numpy.test()
>>> pylab.test('full')
>>> import scipy
>>> scipy.test()

# If you want to have a play with the nifty Spyder IDE focused on Python
# scientific computing (http://packages.python.org/spyder/):
$ pip install rope pyflakes pylint sphinx
$ hg clone https://spyderlib.googlecode.com/hg/ spyderlib
$ python setup.py install
@mkelley33
Copy link

Just FYI: brew install pyqt is doesn't work (returns a 404)

@ches
Copy link
Author

ches commented Jul 14, 2011

Sorry to hear you had trouble. I suspect it's just a temporary issue, though -- anyone encountering such problems may want to check Homebrew's issue tracker for reports about status of the PyQt formula. It has a particularly noteworthy caveat (note the comment):

$ brew cat pyqt | head
require 'formula'

# Note: this project doesn't save old releases, so it breaks often as
# downloads disappear.

class Pyqt < Formula
  url 'http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.8.4.tar.gz'
  homepage 'http://www.riverbankcomputing.co.uk/software/pyqt'
  md5 'c9114258f494cafa87fc2740364fa7f4'

It looks like it shouldn't 404 right now though:

$ curl -I http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.8.4.tar.gz
HTTP/1.1 200 OK
Date: Thu, 14 Jul 2011 23:43:36 GMT
Server: Apache/2.2.14 (Ubuntu)
Last-Modified: Sun, 01 May 2011 13:10:52 GMT
ETag: "a45ac-956616-4a236a2e9af00"
Accept-Ranges: bytes
Content-Length: 9790998
Content-Type: application/x-gzip

@mkelley33
Copy link

Thanks for pointing me in the right direction!

@ches
Copy link
Author

ches commented Jul 15, 2011

Hope you got it working :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment