[pymvpa] Fwd: Getting PyMVPA to work on Mac OS X: problems + finally getting it to work

Michael Hanke michael.hanke at gmail.com
Tue Aug 5 06:50:10 UTC 2008

Forwarding a message from Rajeev Raizada, who had to explore the current
of pynifti's and pymvpa's installation procedures on MacOS. Hope this helps
others to get started....


---------- Forwarded message ----------
From: Rajeev Raizada <rajeev.raizada at dartmouth.edu>
Date: Tue, Aug 5, 2008 at 12:49 AM
Subject: Getting PyMVPA to work on Mac OS X: problems + finally
getting it to work
To: pkg-exppsy-pymvpa at lists.alioth.debian.org.
Cc: Rajeev Raizada <rajeev.raizada at dartmouth.edu>

Dear PyMVPA folks,

After some struggle getting PyMVPA to work on Mac OS X (10.5.4),
here are the steps that worked for me.
I think that it would be very useful if this info or parts of it
were put onto the PyMVPA webpage and the README files,
as the current info in them isn't enough to get things to work on the Mac.

I obtained the sources for pymvpa and pynifti using git,
using the commands from these websites:
git clone git://git.debian.org/git/pkg-exppsy/pymvpa.git
git clone http://git.debian.org/git/pkg-exppsy/pynifti.git
I got git from here:

Orginally I tried using the Python that is built into Mac OS X,
with the scientific and numerical libraries from http://www.sagemath.org/
Using this built-in python, pynifti failed to work, for reasons that
are mysterious to me.
Then, following a suggestion from Michael, I tried using Enthought Python:
With Enthought Python, things eventually worked,
although the following tweaks were required.

Following the instructions in pynifti/doc/manual/manual.txt,
I did this:

 make 3rd
 python setup.py build_ext
 sudo python setup.py install

To test whether it worked, I started up python,
and typed "import nifti" at the prompt.
This failed with the message
"ImportError: No module named _nifticlib".
However, when I started up a new Terminal.app tab,
started Python in that, and then did "import nifti" in that, it worked!
Note that it needed a new terminal session.
Simply typing "source ~/.bashrc" in my existing session
did not do the trick.

At first, I simply did
 python setup.py build_ext
 python setup.py build
...but then the tests failed when they tried to run any SVM stuff.
Digging into pymvpa/doc/intro.txt,
I found the following line that I needed to execute:
cd 3rd/libsvm
g++ -O2 -c svm.cpp
ar cur libsvm.a svm.o
cd ../..  [ to get back into the main pymvpa dir ]
PYMVPA_LIBSVM=1 python setup.py build_ext --swig-opts="-c++ -noproxy"
-I3rd/libsvm -L3rd/libsvm

This gave me the following warning,
although it didn't seem to actually cause anything to break:
"ld: warning in 3rd/libsvm/libsvm.a, file is not of required architecture"

So, I executed that above set of commands first.
It might be easier if this were taken care of in setup.py

Then I did
python setup.py build_ext
sudo python setup.py install

To test whether it worked, I went into pymvpa/doc/examples/
to try to run the scripts in that dir.
However, it turns out that these examples expect the data directory
to be a subdirectory of examples, when it is in fact higher up.
This link command, executed in the examples dir, fixes that:

ln -s ../../data data

Then, if I tried, e.g.
python searchlight_2d.py
but I got errors about smlrc.dylib not being found.
I fixed this as follows:
sudo ln -s smlrc.so smlrc.dylib

Then it all worked:
e.g. I got number crunching and nice graphics from, e.g.:
python searchlight_2d.py
python sensanas.py

My guess is that installations on people's Macs
may appear to be working, but unless the above tweaks are made,
they may not be fully working.
e.g. I had to put the symbolic link in by hand
between smlrc.so and smlrc.dylib

If the above info were on the PyMVPA webpage,
then that would save people needing to work it out by trial and error.

The only Mac OS X info that is on the webpages
is advice about changing the Makefile to include i386 and ppc, here:
saying to put this line in the Makefile
CFLAGS=-Wall -O2 -I. -DHAVE_ZLIB -arch ppc -arch i386
This change doesn't appear to be actually needed,
as all the above steps worked fine without doing it.

I hope this helps,



GPG key: 1024D/3144BE0F Michael Hanke
ICQ: 48230050
Jabber: michael.hanke at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20080805/2b98c9be/attachment.htm 

More information about the Pkg-ExpPsy-PyMVPA mailing list