How to get mpi4py to work on Windows

alxg picture alxg · May 22, 2016 · Viewed 9.3k times · Source

I'm trying to use mpi4py.

I have mpi4py installed from the Anaconda package, and

pip install mpi4py

recognizes this.

But when i run

from mpi4py import MPI

says MPI module doen't exist.

I've looked in the mpi4py folder and indeed i can't find it.

i think the problem is that i might not have OpenMPI installed, but i've been looking everywhere and i can't find how to install ir on Windows 10.

Please help.

Edit: The original question was about installing OpenMPI on windows 10 and use it with mpi4py, but since i found a way to run mpi4py with MSMPI i changed the title so people trying to do the same at least have a work-around.

Answer

user6658022 picture user6658022 · Jul 30, 2016

Set the MSMPI path (by default C:\Program Files\Microsoft MPI\Bin) in the %PATH% environment variable (http://www.computerhope.com/issues/ch000549.htm).

After that, you can launch your program by running the command:

mpiexec /np <number of process> python <your MPI4Py python script>