8

I'm trying to install a python(3) package which depends on mpi4py on a CentOS 7 machine.

I have tried multiple ways of doing everything, even start from clean virtualenvs but I keep getting:

ImportError: $PATH_TO_VENV/lib/python3.6/site-packages/mpi4py/MPI.cpython-36m-x86_64-linux-gnu.so: undefined symbol: ompi_mpi_logical8

This comes up even if, after a successful installation through pip, I just write in the interpreter:

>>> import mpi4py
>>> from mpi4py import MPI

Has anyone got a solution for this?

ClonedOne
  • 569
  • 4
  • 20

3 Answers3

3

I had the same problem and I found that I have to install the library using the env MPICC= prefix.

env MPICC=/usr/lib64/openmpi/bin/mpicc pip install --no-cache-dir mpi4py
gncs
  • 460
  • 7
  • 19
2

I met this problem today, this is how I solve it: conda install mpi4py

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
mpi-1.0                    |          openmpi           4 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
mpi4py-3.0.3               |   py37hbfacf26_1         647 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
openmpi-4.0.3              |       hdf1f1ad_1         3.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
------------------------------------------------------------
                                       Total:         4.6 MB

I think either missing mpi-1.0 or an out-dated openmpi will cause the problem.

Li Ang
  • 21
  • 2
1

The problem is that mpi4py was installed while a different than the current version of MPI was used.

pip uninstall mpi4py
pip install --no-cache-dir mpi4py

The above should resolve the problem. Maybe resourcing the virtualenv is neccessary.

F.M.F.
  • 1,929
  • 3
  • 23
  • 42