无法使用pip安装mpi4py

问题描述 投票:0回答:3

我已经创建了一个 conda 环境,我正在尝试使用 pip 安装 mpi4py。当我这样做时,我收到以下错误:

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

如错误最后一部分所述,我尝试使用 find 查找 libm.so.6 和 libz.so.1 是否存在。我发现libm.so.6不在那里,但是libz.so.1在那里,仍然说没有找到它。任何调试此问题的帮助将不胜感激。以下详细信息可能有用:

  • Ubuntu:22.04
  • OpenMPI:4.0.7
  • Python:3.9.12
  • 点:21.2.4
  • 轮子:0.37.1
pip parallel-processing openmpi mpi4py
3个回答
14
投票

与conda提供的python有关

标志“-B /home/pavan/miniconda3/envs/codelab/compiler_compat”将要求编译器从该路径获取 ld 。但是当你使用不同的编译工具链时,conda提供的ld会导致一些问题。

修复步骤:

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

并尝试再次构建 mpi4py。

之后,撤销该更改:

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

1
投票

该错误仅发生在 Python 3.9 上,但在 Python 3.8 上工作正常。上面建议的临时删除 conda ld 的修复对我有用,但不确定为什么它只发生在 Python 3.9 上以及是否有任何其他修复。


0
投票

我刚刚将

libm.so.6
的路径(或根据警告未找到的任何库)添加到动态链接器路径中:

export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/

以便 conda 的

ld
可以拾取它。然后
pip install mpi4py
效果很好。您不需要将此导出行添加到您的
~/.bashrc
(这不是最佳实践),我仅在运行
pip install
的终端会话中执行此操作。

© www.soinside.com 2019 - 2024. All rights reserved.