Packaging yt, NumPy, VTK on OS X Snow Leopard

Packaging is one of the hardest issues for distributing scientific applications.  For yt we actually don't have much of a problem for Linux systems -- everything usually installs right out of the box.  The only real issues are either wxPython, because the underlying X11 and GTK libraries aren't on the system (I'm looking at you, TeraGrid!) or a mismatch in the current compiler module that's loaded.  (For instance, having PGI loaded while trying to compile with GCC.  In my experience, the "module" system as a whole seems to give only epsilon more functionality than the headaches it gives, but that's neither here nor there.)

OS X, though, is an exceptionally different beast -- and with Snow Leopard, it only got worse.  The 64-bit setup, the 10.6 SDK, etc etc, only made things more headachy and complicated.  (I still don't have PyCUDA working, which one of the major reasons I've shifted over to OpenCL as a GPU platform!)  After much struggling with install paths and compiler locations, I managed to get our Numpy + Matplotlib + H5py + Python2.6 stack relocatable and strictly 10.6-based, however, and I finally set up an installer repository.  I've had a couple people test the installation script and it works, tossing all the packages out onto their system.  (If you've stumbled across this post hoping for a superpack installer, the installation script -- which will also install yt! -- is described here.  It doesn't include SciPy, though.)

However, there are a couple problems with 10.6 as a whole -- mainly the lack of easy solutions for wxPython (depends on Carbon), Pyglet (depends on Carbon) and PyCUDA, which despite supposedly being able to work in 32 bit mode has never successfully launched with my hand-rolled (fat-binary) Python 2.6.  Boost, also, required some mangling of the library path with install_name_tool, as it kept wanting to link against the wrong Python!

Anyway!  As the capabilities of yt expand, I really want to get more people on board with things like VTK, TVTK, ETS and maybe some other fun things.  Installing VTK was the biggest hurdle -- it's got a lot of moving parts, the installation is a bit non-trivial, and compilation on 10.6 has been tricky at times.  However, just by chance I was listening to the FLOSS Weekly show (#111) about CMake, where discussion of CPack led me to investigate it.  CMake is the underlying make system built by Kitware for things like ITK, VTK and other projects.  KDE uses it now, too.  CPack, evidently, was designed to make portability and installation much easier.

So, I gave it a whirl.  The VTKCPack.cmake file had to be modified such that it installed if VTK_WRAP_PYTHON were enabled (it defaults to VTK_WRAP_TCL) but after that, it Just Worked.  "cpack -G PackageMaker" happily and easily generated a .mpkg file.  The .mpkg file doesn't include the Python package, but a simple "setup.py mpkg_bdist" made a second one of those.  I've sent both out for more rigorous testing, but I think they should do just fine.  Once we have seeded those, I'll give a shot at making packages on Linux, as well -- and then maybe we can start distributing VTK and encouraging its use as a visualization system!  The problem has always been just in distribution, never in capability.  And the distribution problem, I guess, has been solved for a while -- we just didn't know it!  Kudos to the Kitware folks for this excellent system.

(As a side note, I really would prefer just to suggest people install EPD rather than my hand-rolled, difficult to maintain stack.  Unfortunately, we're still having trouble figuring out how to get our C-modules that interface with HDF5 on a low-level basis to play nice with EPD.)
Meta