PyLab with iPython on MacOS X 64-bit

Putting this here for search engine fodder, since it took me a while to figure out...

If you try to run the way-cool PyLab feature of iPython on MacOS X with a 64-bit platform (e.g., my iMac running Lion), you get this:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found.  Did find:
    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper

What this rather cryptic error means is that the library is 32-bit. To get it to work simply run it with the "arch -i386" command:

$ arch -i386 ipython --pylab

The numpy module should now load normally, and PyLab should start.

Published: March 08 2012

  • category: