pipparallel-processingopenmpimpi4py

Not able to install mpi4py using pip


I have created an conda environment and I am trying to install mpi4py using pip. I am getting following error when I do that:

Collecting mpi4py
  Using cached mpi4py-3.1.3.tar.gz (2.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: mpi4py
  Building wheel for mpi4py (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/pavan/miniconda3/envs/codelab/bin/python /home/pavan/miniconda3/envs/codelab/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmppevhrinu
       cwd: /tmp/pip-install-gxgbr0vg/mpi4py_2f4b2eeacbc0465493035e6fe3c8dbdd
  Complete output (170 lines):
  running bdist_wheel
  running build
  running build_src
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-39
  creating build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/bench.py -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/__main__.py -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/run.py -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/__init__.py -> build/lib.linux-x86_64-cpython-39/mpi4py
  creating build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/_base.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/pool.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/server.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/aplus.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/_lib.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/__main__.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/__init__.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/_core.py -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  creating build/lib.linux-x86_64-cpython-39/mpi4py/util
  copying src/mpi4py/util/pkl5.py -> build/lib.linux-x86_64-cpython-39/mpi4py/util
  copying src/mpi4py/util/dtlib.py -> build/lib.linux-x86_64-cpython-39/mpi4py/util
  copying src/mpi4py/util/__init__.py -> build/lib.linux-x86_64-cpython-39/mpi4py/util
  copying src/mpi4py/py.typed -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/dl.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/__main__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/run.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/__init__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/MPI.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/bench.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/__init__.pxd -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/MPI.pxd -> build/lib.linux-x86_64-cpython-39/mpi4py
  copying src/mpi4py/libmpi.pxd -> build/lib.linux-x86_64-cpython-39/mpi4py
  creating build/lib.linux-x86_64-cpython-39/mpi4py/include
  creating build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
  copying src/mpi4py/include/mpi4py/mpi4py.h -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
  copying src/mpi4py/include/mpi4py/mpi4py.MPI.h -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
  copying src/mpi4py/include/mpi4py/mpi4py.MPI_api.h -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
  copying src/mpi4py/include/mpi4py/mpi4py.i -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
  copying src/mpi4py/include/mpi4py/mpi.pxi -> build/lib.linux-x86_64-cpython-39/mpi4py/include/mpi4py
  copying src/mpi4py/futures/__main__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/server.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/__init__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/_core.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/aplus.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/_lib.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/futures/pool.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/futures
  copying src/mpi4py/util/dtlib.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/util
  copying src/mpi4py/util/__init__.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/util
  copying src/mpi4py/util/pkl5.pyi -> build/lib.linux-x86_64-cpython-39/mpi4py/util
  running build_clib
  MPI configuration: [mpi] from 'mpi.cfg'
  MPI C compiler:    /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc
  MPI C++ compiler:  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicxx
  MPI F compiler:    /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpifort
  MPI F90 compiler:  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpif90
  MPI F77 compiler:  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpif77
  checking for library 'lmpe' ...
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c _configtest.c -o _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -llmpe -o _configtest
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: cannot find -llmpe: No such file or directory
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  building 'mpe' dylib library
  creating build/temp.linux-x86_64-cpython-39
  creating build/temp.linux-x86_64-cpython-39/src
  creating build/temp.linux-x86_64-cpython-39/src/lib-pmpi
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c src/lib-pmpi/mpe.c -o build/temp.linux-x86_64-cpython-39/src/lib-pmpi/mpe.o
  creating build/lib.linux-x86_64-cpython-39/mpi4py/lib-pmpi
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -shared -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,--no-as-needed build/temp.linux-x86_64-cpython-39/src/lib-pmpi/mpe.o -o build/lib.linux-x86_64-cpython-39/mpi4py/lib-pmpi/libmpe.so
  checking for library 'vt-mpi' ...
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c _configtest.c -o _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -lvt-mpi -o _configtest
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: cannot find -lvt-mpi: No such file or directory
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  checking for library 'vt.mpi' ...
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c _configtest.c -o _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -lvt.mpi -o _configtest
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: cannot find -lvt.mpi: No such file or directory
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  building 'vt' dylib library
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c src/lib-pmpi/vt.c -o build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -shared -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,--no-as-needed build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt.o -o build/lib.linux-x86_64-cpython-39/mpi4py/lib-pmpi/libvt.so
  checking for library 'vt-mpi' ...
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c _configtest.c -o _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -lvt-mpi -o _configtest
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: cannot find -lvt-mpi: No such file or directory
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  checking for library 'vt.mpi' ...
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c _configtest.c -o _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -lvt.mpi -o _configtest
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: cannot find -lvt.mpi: No such file or directory
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  building 'vt-mpi' dylib library
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c src/lib-pmpi/vt-mpi.c -o build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt-mpi.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -shared -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,--no-as-needed build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt-mpi.o -o build/lib.linux-x86_64-cpython-39/mpi4py/lib-pmpi/libvt-mpi.so
  checking for library 'vt-hyb' ...
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c _configtest.c -o _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -lvt-hyb -o _configtest
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: cannot find -lvt-hyb: No such file or directory
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  checking for library 'vt.ompi' ...
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c _configtest.c -o _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -lvt.ompi -o _configtest
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: cannot find -lvt.ompi: No such file or directory
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  building 'vt-hyb' dylib library
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -c src/lib-pmpi/vt-hyb.c -o build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt-hyb.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -shared -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,--no-as-needed build/temp.linux-x86_64-cpython-39/src/lib-pmpi/vt-hyb.o -o build/lib.linux-x86_64-cpython-39/mpi4py/lib-pmpi/libvt-hyb.so
  running build_ext
  MPI configuration: [mpi] from 'mpi.cfg'
  MPI C compiler:    /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc
  MPI C++ compiler:  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicxx
  MPI F compiler:    /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpifort
  MPI F90 compiler:  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpif90
  MPI F77 compiler:  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpif77
  checking for dlopen() availability ...
  checking for header 'dlfcn.h' ...
  gcc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -I/home/pavan/miniconda3/envs/codelab/include/python3.9 -c _configtest.c -o _configtest.o
  success!
  removing: _configtest.c _configtest.o
  success!
  checking for library 'dl' ...
  gcc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -I/home/pavan/miniconda3/envs/codelab/include/python3.9 -c _configtest.c -o _configtest.o
  gcc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -Lbuild/temp.linux-x86_64-cpython-39 -ldl -o _configtest
  success!
  removing: _configtest.c _configtest.o _configtest
  checking for function 'dlopen' ...
  gcc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -I/home/pavan/miniconda3/envs/codelab/include/python3.9 -c _configtest.c -o _configtest.o
  gcc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -Lbuild/temp.linux-x86_64-cpython-39 -ldl -o _configtest
  success!
  removing: _configtest.c _configtest.o _configtest
  building 'mpi4py.dl' extension
  gcc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -DHAVE_DLFCN_H=1 -DHAVE_DLOPEN=1 -I/home/pavan/miniconda3/envs/codelab/include/python3.9 -c src/dynload.c -o build/temp.linux-x86_64-cpython-39/src/dynload.o
  gcc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -shared -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath,/home/pavan/miniconda3/envs/codelab/lib -Wl,-rpath-link,/home/pavan/miniconda3/envs/codelab/lib -L/home/pavan/miniconda3/envs/codelab/lib build/temp.linux-x86_64-cpython-39/src/dynload.o -Lbuild/temp.linux-x86_64-cpython-39 -ldl -o build/lib.linux-x86_64-cpython-39/mpi4py/dl.cpython-39-x86_64-linux-gnu.so
  checking for MPI compile and link ...
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -I/home/pavan/miniconda3/envs/codelab/include/python3.9 -c _configtest.c -o _configtest.o
  success!
  removing: _configtest.c _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -I/home/pavan/miniconda3/envs/codelab/include -fPIC -O2 -isystem /home/pavan/miniconda3/envs/codelab/include -fPIC -I/home/pavan/miniconda3/envs/codelab/include/python3.9 -c _configtest.c -o _configtest.o
  /home/pavan/packages/openmpi-4.0.7/opt-gfortran/bin/mpicc -pthread -B /home/pavan/miniconda3/envs/codelab/compiler_compat _configtest.o -Lbuild/temp.linux-x86_64-cpython-39 -o _configtest
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: warning: libm.so.6, needed by /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libmpi.so, not found (try using -rpath or -rpath-link)
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: warning: libz.so.1, needed by /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libopen-rte.so.40, not found (try using -rpath or -rpath-link)
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libopen-rte.so.40: undefined reference to `inflate'
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libmpi.so: undefined reference to `log@GLIBC_2.29'
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libmpi.so: undefined reference to `sqrt@GLIBC_2.2.5'
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libopen-rte.so.40: undefined reference to `deflate'
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libopen-rte.so.40: undefined reference to `deflateInit_'
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libopen-rte.so.40: undefined reference to `inflateEnd'
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libopen-rte.so.40: undefined reference to `deflateEnd'
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libopen-rte.so.40: undefined reference to `deflateBound@ZLIB_1.2.0'
  /home/pavan/miniconda3/envs/codelab/compiler_compat/ld: /home/pavan/packages/openmpi-4.0.7/opt-gfortran/lib/libopen-rte.so.40: undefined reference to `inflateInit_'
  collect2: error: ld returned 1 exit status
  failure.
  removing: _configtest.c _configtest.o
  error: Cannot link MPI programs. Check your configuration!!!
  ----------------------------------------
  ERROR: Failed building wheel for mpi4py
Failed to build mpi4py
ERROR: Could not build wheels for mpi4py which use PEP 517 and cannot be installed directly

As mentioned in the last part of error, I tried to find if libm.so.6 and libz.so.1 are present or not using find. I found that libm.so.6 was not there, but libz.so.1 is there, still it is saying it didn't find it. Any help to debug this will be much appreciated. Following details might be useful:


Solution

  • It was related to python provided by conda.

    the flag "-B /home/pavan/miniconda3/envs/codelab/compiler_compat" will ask the complier to pick up ld from that path. but the ld provided by conda will cause some issue when you are using different compiler toolchains.

    step to fix it:

    cd /home/pavan/miniconda3/envs/codelab/compiler_compat
    rm -f ld
    ln -s /usr/bin/ld ld
    

    and try to build mpi4py again.

    after that, revoke that change:

    cd /home/pavan/miniconda3/envs/codelab/compiler_compat
    rm -f ld
    ln -s ../bin/x86_64-conda-linux-gnu-ld ld