Wednesday, May 28, 2014

Biopython upgrade on Mac OSX 10.6

One slightly frustrating thing about the Macintosh is that although it comes with Python installed, the versions are out of date. It is possible to install Python from python.org, which replaces the command line one, and also has the idle IDE. However I was finding it difficult to install python packages into that newer version. I would find commands like:

$ easy_install -f http://biopython.org/DIST/ biopython

$ pip install numpy

$ pip install nose

But those would install things to the older versions. By searching around, here's what I found. The provided pythons install into /Library/Python/2.6/site-packages/ or related directories, while the python.org version wants to install into /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages. The easy_install command that my system used was in /usr/bin/easy_install. I managed to get the python.org version to install easy_install (setuptools) with the following command:

$ curl https://bootstrap.pypa.io/ez_setup.py -o - | python

And then upgraded biopython with the following:

$ python -m easy_install --upgrade biopython

That tells the command line version of python, which is the 2.7/python.org version to use its own easy_install command, I am not sure that was strictly necessary because the 'which' command now showed that would be the default:

$ which easy_install

/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install

# and biopython looks ok, though there were some compilation warnings

$ python

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)

[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import Bio

>>> Bio.__version__

'1.63'

# used to be 1.57