Open spossann opened 11 months ago
I just tried this on Fedora Linux 38 (and with podman and instead of docker) and the basic import
works fine with no errors.
I notice you are installing both the Fedora-provided python3-mpi4py-openmpi
and mpi4py
via pip. I tried both, and both seem fine.
The errors you see seem to be something to do with accessing the NIC — or is that a red herring?
Thanks for the quick reply. To be clear: import mpi4py
works for me, what does not work is
from mpi4py import MPI
I clarified this in the issue title. The namespace of mpi4py
looks like this:
Python 3.11.5 (main, Aug 28 2023, 00:00:00) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpi4py
>>> dir(mpi4py)
['Rc', '__all__', '__author__', '__builtins__', '__cached__', '__credits__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'get_config', 'get_include', 'profile', 'rc']
and
>>> dir(mpi4py.__all__)
['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
I also tried removing python3-mpi4py-openmpi
but the error persists.
from mpi4py import MPI
as in your example above is exactly what I did in attempting to duplicate your issue. Sorry that wasn't clear.
Adding these environment variables seemed to resolve this issue for me. OMPI_MCA_pml=ob1 OMPI_MCA_btl=tcp,self
I have been using mpi4py with the image fedora:37 for a while without issues. However, with fedora:38 (and later) I see the following error:
I build the following image via
docker build -t fedora_test -f docker/fedora.dockerfile .
:then run a container with
docker run -it fedora_test
and load the openmpi moduleI then launch a Python virtual environment
and install mpi4py:
Upon launching
python3
and importingMPI
from mpi4py, I get the following error:The program is stuck from there on. All of the above steps work fine with the image fedora:37.
Here are some infos on my OS: