Installing Traits and Chaco on OS X 64 bit - tiagopereira/python_tips GitHub Wiki

Enthought's traits and chaco packages are extremely powerful and simple tools to build GUIs for scientific applications. Unfortunately, installation of these libraries is not always easy. The easiest way is to install EPD, the Enthought Python Distribution. If you have OS X and want a 64-bit version of python, you're out of luck. EPD for this architecture does not include the graphical packages because it uses wxPython 2.8, which is not available in 64-bit for OS X. (It can work with wxPython 2.9, which supports 64-bit, but is whose API is not as stable and has other issues.)

This page provides simple instructions to install a complete 'scientific python 2.7' installation with scipy, numpy, matplotlib, traits, chaco (and a bunch of other goodies) on OS X 64-bit. All of this using MacPorts. It makes use of the PyQt toolkit instead of wx, which works better in OS X 64-bit. Note: many chaco/traitsui examples make use of wx directly, so are not usable in this configuration.

These instructions worked for me on OS X 10.6 and 10.7, but there is no guarantee they'll work for you.

  1. Install Xcode, if you don't have it yet (required for MacPorts).

  2. Install MacPorts (download dmg; install package; do a 'sudo port selfupdate'; 'sudo port sync')

  3. Give the following MacPorts commands (in this order!) to install python and a lot of its scientific packages:

  • sudo port install py27-scipy
  • sudo port install ghostscript +no_x11 # useful for saving eps/pdfs from matplotlib
  • sudo port install py27-matplotlib +ghostscript +qt4
  • sudo port install py27-ipython +pyqt4 +scientific
  • sudo port install netcdf +netcdf4 # optional
  • sudo port install py27-cython py27-distribute py27-enthoughtbase swig-python py27-pil py27-pyfits py27-netcdf4
  1. Now you need to download from github the following Enthought packages: traits, pyface, traitsui, enable, and chaco. You can either get the source through git or follow those links and get the 'zip' version of each package. Whatever way you get it, go to each package's base directory and do 'sudo python setup.py install'. Do it in order: traits, pyface, traitsui, enable, chaco. If you don't install them in order, packages will try to install missing dependencies with easy_install, which means you may get an older (incompatible) version.