Sacooley1
Sacooley1

Reputation: 21

ImportError: No module named mpi4py

I am brand new to parallel computing and I'm trying to set up a small cluster of Raspberry Pi's to fiddle around with. Whenever I went to install mpi4py, I used pip3 install mpi4py but I am still getting the following error when I try to run a simple test script. I am able to use mpiexec with a Hello World script that prints "Hello" for every core in the cluster.

Hardware is a cluster Raspberry Pi 3B+ running Rasbian Lite

test.py:

from mpi4py import MPI

print("Test")

This is the readout that I am getting from the command line:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from mpi4py import MPI
ImportError: No module named mpi4py

Thanks in advance

Upvotes: 0

Views: 1928

Answers (1)

Sacooley1
Sacooley1

Reputation: 21

I found the solution, and frankly I feel a little silly now. I wasn't aware that Debian for Raspberry Pi comes preinstalled with both Python 2 and Python 3, so I have run to mpiexec -hostlist nodes_ips python3 test.py instead.

Upvotes: 1

Related Questions