Revision as of 08:33, 3 June 2016 by Aclexp (talk | contribs) (→‎Use python effectively in OSX)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Install Homebrew on OS earlier than 10.9

ruby -e "$(curl -fsSkL"

(in .bash_profile)
export PATH=/usr/local/sbin:/usr/local/bin:$PATH

Install pymvpa (adapted from Moffet's Crash Log)

1) Install Homebrew:
ruby -e "$(curl -fsSL"
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://

16)Install libsvm:
brew install gnuplot
brew install qt4
brew install libsvm

17)Install PyMVPA:
make 3rd
python build_ext –with-libsvm
python install –with-libsvm
18) Download tutorial data at:
19) Unzip and Place data in /Users/Shared/PyMVPA/Tutorial_Data

And remember that you should cd to another directory when calling the test command:

from  mvpa2.tutorial_suite import *

Otherwise you will see the following complaint:

WARNING: Failed to load fast implementation of SMLR.  May be you forgotten to build it.  We will use much slower pure-Python version. Original exception was dlopen(mvpa2/clfs/libsmlrc/, 6): image not found
 * Please note: warnings are printed only once, but underlying problem might occur many times *
WARNING: SMLR: C implementation is not available. Using pure Python one

This is because when you import mvpa2 under the pymvpa source code directory (where you make it), python takes the mvpa-subdirectory as the place from where is imports the mvpa-package. This won't work, at least for SVM / SMLR, that use C-code bindings that have to be compiled (source).

Use python effectively in OSX

After Homebrew installation is done, we can install Python. We’re going to start by installing Python 2.7:

$brew install python

Now, we need to tell the system to use our freshly new Python interpreter instead of the default one.

$ which python

The default Python interpreter is under /usr/bin, and the Homebrew’s one is under /usr/local/bin so we’re going to edit /etc/paths so the /usr/local/bin binaries will be prioritised over /usr/bin.

$ sudo nano /etc/paths

If you open /etc/paths, you should see this:


Move /usr/local/bin at the beginning of the file so Homebrew binaries take on system binaries;


Finally, check everything is ok: typing python should launch the Homebrew version

$ source /etc/paths
$ which python

$ python
Python 2.7.8 (default, Jul  2 2014, 10:14:46)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.