Installing PyMVPA on Mac OS X

These instructions work on 10.10 (Yosemite) and 10.11 (El Capitain).  If things change in the future, I’ll try to update these instructions!

Multi-voxel Pattern Analysis (MVPA) is hot right now.  Its users are the cool kids at conferences.  And if you want to join that crowd of researchers, you have a growing possibility of solutions to perform MVPA without having to resort to writing your own.  The list that I’ll start out with today includes three MATLAB toolboxes: 1) The Decoding Toolbox, 2) PRoNTo, and 3) the long-since updated Princeton MVPA Toolbox.  And of course the non-MATLAB possibility featured in todays post is PyMVPA.

Now as you may have already realized, the first three require MATLAB.  If you don’t have MATLAB, you could try to find instructions to run these toolboxes in Octave.  But that may be more tech stuff that you don’t want to deal with!  Python has the advantage of being Open Source, Free, and relatively close to MATLAB in many of its syntactic qualities.  So today I’ll detail the installation of PyMVPA and in a later post, I’ll talk about some of the other MVPA solutions.

The way I see it, at this very moment, you have about four options for installing PyMVPA on your Mac.  The first is to install the NeuroDebian Virtual Machine, which runs in Virtual Box (a Free PC Emulator software).  If you go this route, you’ll be almost guaranteed a smooth transition to having the software installed.  Of course you’ll have to fight against the slowness of any virtual machine and may be limited by how much hard drive space and RAM your computer has.

The second solution is to install MacPorts, and use it to install all of the necessary components for you.  This is a fairly straightforward (and seems to be recommended way by the maintainers of PyMVPA).

sudo port install py25-pymvpa +scipy +nibabel \
 +hcluster +libsvm +matplotlib +pywavelet

However, I will say that not everyone likes installing MacPorts.  So that brings me to the third solution is to install something like Enthought, a ready made Python environment with a number of dependencies (Numpy, Scipy) already installed for you.  The good news is that there is a free version of this toolkit and it really is smooth to install.  After the installation you’ll just have to grab the source code and follow the install from source instructions.

And finally, we reach the fourth option.  To install PyMVPA onto your computer by satisfying the dependencies yourself!  Here I recommend, if you don’t already, having Homebrew installed!  You’ll also need to grab a copy of Xcode (via the AppStore).  The rest of the instructions suggest that you setup a Virtual Environment, so that your don’t have to globally install packages on your computer, with the necessary dependencies.  This has the advantage of keeping everything mostly contained so that you could run different versions of any package without breaking your PyMVPA installation!  Also note that the install directory is in the Shared Users area, which is handy because you can have multiple users share the same environment.  The following should be run in a terminal.  Some have a description and the command after the colon (:).
1) Install Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2) mkdir /Users/Shared/PyMVPA; cd  /Users/Shared/
3) sudo easy_install pip
4) pip install virtualenv
5) virtualenv PyMVPA
6) cd PyMVPA
7) . bin/activate
8) pip install numpy
9) pip install scipy
10) pip install nibabel
11) pip install ipython'[all]’
12) pip install scikit-learn
13) pip install matplotlib
14) brew install swig
15) Grab the PyMVPA source (and place into your virtualenv folder):
git clone git://github.com/PyMVPA/PyMVPA.git
16) Install PyMVPA:
make 3rd
python setup.py build_ext –with-libsvm
python setup.py install –with-libsvm
17) Download tutorial data at: http://data.pymvpa.org/datasets/haxby2001/
18) Unzip and Place data in /Users/Shared/PyMVPA/Tutorial_Data
And give it a shot!
Comments are closed.