With the new laptop (side note: the 13″ MacBook Pro is a really nice machine. The screen certainly has enough pixels for real work, unlike previous 13″ machines. The only thing missing is a GPU.), it’s time to re-install. Since my last post, I’ve been convinced to upgrade to Python 2.7. Anthony Bak has recently gone through the same thing, so here’s my version of his set of notes on how to do this:
- ActiveState, the EPD, etc. are great, but don’t seem to play nicely with a few external packages.
- CMake causes lots of trouble, but there doesn’t seem to be a good alternative. I’m not sure why the macports version can’t be made to “just work”.
0) Fully uninstall macports (http://guide.macports.org/#installing.macports.uninstalling). Follow the full set of directions.
Then, go through your .bashrc/.bash_profile and collect all of the macports-related changes (they’ll all have /opt in them). Stick them at the end so that you can combine them with whatever macports does to your init files during the rest of the install.
1) Set /opt/local/etc/macports/variants.conf to contain
+python27 +py27 -python26 -py26 -universal +bash_completion
You’ll have to make the file and the directories, assuming you followed step 0.
2) Install the latest and greatest macports, using the package install and the easy options (http://guide.macports.org/#installing.macports). The rest of this guide was done with MacPorts-2.0.4-10.7-Lion.dmg.
3) Open a new shell so that your path is correct and run
sudo su # port requires superuser privs
port upgrade outdated
port install coreutils python27
port select –set python python27
port install cmake boost mercurial cairo eigen py27-cython py27-numpy py27-scipy py27-wxpython-devel py27-matplotlib py27-pil
Note that we aren’t installing py27-wxpython because it requires
universal builds (which will mess up some other choices) so we use
4) Edit .bash_profile
Also in there
5) Now we handle cgal.
port extract cgal
Apply this patch:
The files are in
and the patch is tiny enough that it’s faster to just do it by hand.
Don’t install cgal. Instead
port build cgal
port install cgal
6) Download the openbable source distribution (latest is 2.3.1) . We’ll be installing by hand.
cmake -DCMAKE_INSTALL_PREFIX=/opt/local/ -DPYTHON_BINDINGS=YES ../
Edit CMakeCache.txt to fix all the python paths. Use
So, in emacs, a straightforward search and replace for /Library/Frameworks/Python.framework/ –> /opt/local/Library/Frameworks/Python.framework/ should work, but I had some trouble if I didn’t specify the specific version, so
/Library/Frameworks/Python.framework/ –> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/
and even that never really worked for me. I also had to change a couple of instances of /usr/local/lib/python… to point to opt. And then the install failed. It installed all of the ob tools, but not the python .so. So, I copied it over by hand, and that seems to work.
So far, I am unable to get Mayavi installed from source. It works with the EPD, so I actually have two Python installations at the moment, sadly enough.
7) Install Dionysus(http://www.mrzv.org/software/dionysus/get-build-install.html). You have to tell it where the CGAL cmake files are.
Now edit the CMakeCache.txt file. Fix the python headers/path and
change the cgal dir (and maybe the same for boost).
mv lib_dionysus.dylib /opt/local/lib/
mv dionysus /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
ln -s /opt/local/lib/lib_dionysus.dylib _dionysus.so
Install Fastcluster. Download from
sudo su python setup.py install
hg clone https://bitbucket.org/cleemesser/numpy-sharedmem
sudo python setup.py install
When you have time (on my machine graph-tool takes many hours and uses
>4GB durring the build phase):
port install py27-scikits-learn py27-scikits-statsmodels py27-networkx