Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python beginner - No module named 'mpi4py'

I'm a student and I'm using python for the first time.

Currently I'm using Xubuntu 19.10 on a virtual machine, I checked the python and mpi4py installation.

My professor of "Parallel programming" gave me this simple python code.

from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
print ("hello world from process ", rank)

I'm trying to run it but it doesn't works and I don't know how to fix it. When I try to execute, I receive this statement for each of the 4 process:

$ mpirun -n 4 python3 hello.py
Traceback (most recent call last):
     File "hello.py", line 3, in <module>
     from mpi4py import MPI
ModuleNotFoundError: No module named 'mpi4py'
like image 902
Lkmuraz Avatar asked Sep 03 '26 01:09

Lkmuraz


1 Answers

you can install mpi4py via pip in your terminal

pip install mpi4py

or

 pip3 install mpi4py
like image 111
ArunJose Avatar answered Sep 04 '26 16:09

ArunJose



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!