error with mpi4py even if installed

6 views
Skip to first unread message

Luigi Marongiu

unread,
Apr 14, 2021, 9:36:09 AMApr 14
to mpi4py
Hello,
I have installed mpi4py but when I try to use it, I get an error message:
```
$ conda activate tip_finder
(tip_finder) :~

(tip_finder) :~$  pip3 install mpi4py
Requirement already satisfied: mpi4py in ./src/conda/envs/tip_finder/lib/python3.7/site-packages (3.0.3)

(tip_finder) :~$ mpirun -np 12 ...
Traceback (most recent call last):
  File "/home/gigiux/src/TIP/TIP_finder.py", line 16, in <module>
    from mpi4py import MPI
ModuleNotFoundError: No module named 'mpi4py'
```
I even repeated by installing with conda system-wide; in the environment, mpi4py resulted installed (as expected) but I got the same error.
I am working with Ubuntu 20. 
What could be the problem? How can I solve it? 
Thank you

Lisandro Dalcin

unread,
Apr 14, 2021, 12:16:52 PMApr 14
to mpi...@googlegroups.com
My best guess is that your environment is broken. Looks like the python interpreter you are executing is not the right one. 
Please add the following two lines to the very beginning of your main script:

import sys
print(sys.executable)
print(sys.path)

First launch it with only one mpi process (mpiexec -n 1 ...), and next two (mpiexec -n 2), and then jump to 12. 

What do you get?


--
You received this message because you are subscribed to the Google Groups "mpi4py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mpi4py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mpi4py/ede53993-6d24-4b41-800e-5f84e1316e64n%40googlegroups.com.


--
Lisandro Dalcin
============
Senior Research Scientist
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/
Reply all
Reply to author
Forward
0 new messages