Using pyMPVA with Python 3

I’ve used pyMPVA extensively for running multivariate analysis of fMRI data. It’s flexible and simple to customize for complex searchlight analyses. However, I’ve run into some problems when transitioning from Python 2 (which will be officially unsupported as of 2020) to Python 3.

One important feature of pyMVPA is the ability to easily run searchlights, which can be very computationally intensive, using parallel execution distributed over multiple cores. However, pprocess, the library pyMVPA uses to handle parallel execution, does not support Python 3.

To fix this problem, I used conversion tools to make a fork of pprocess with Python 3 support. You can install it using pip:
pip install git+git://

Then, when setting up a searchlight in pyMVPA, set the nproc to the number of cores to use, for example:
sl = sphere_searchlight(..., nproc=6)
to use 6 cores.

While a searchlight is running, on Linux/Unix systems you can use top to verify that the parallel execution is working; you should see multiple python processes appear.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s