对于 python=3.8,MPI4py 安装失败

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

我一直在尝试在 python 版本 3.8 的 Conda 环境中安装

mpi4py
库。

通过 pip 安装时收到以下错误消息

  Building wheel for mpi4py (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for mpi4py (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [148 lines of output]
      running bdist_wheel
      running build
      running build_src
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/__init__.py -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/__main__.py -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/bench.py -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/run.py -> build/lib.linux-x86_64-cpython-38/mpi4py
      creating build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/__init__.py -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/__main__.py -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/_base.py -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/_core.py -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/_lib.py -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/aplus.py -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/pool.py -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/server.py -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      creating build/lib.linux-x86_64-cpython-38/mpi4py/util
      copying src/mpi4py/util/__init__.py -> build/lib.linux-x86_64-cpython-38/mpi4py/util
      copying src/mpi4py/util/dtlib.py -> build/lib.linux-x86_64-cpython-38/mpi4py/util
      copying src/mpi4py/util/pkl5.py -> build/lib.linux-x86_64-cpython-38/mpi4py/util
      copying src/mpi4py/MPI.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/__init__.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/__main__.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/bench.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/dl.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/run.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/py.typed -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/MPI.pxd -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/__init__.pxd -> build/lib.linux-x86_64-cpython-38/mpi4py
      copying src/mpi4py/libmpi.pxd -> build/lib.linux-x86_64-cpython-38/mpi4py
      creating build/lib.linux-x86_64-cpython-38/mpi4py/include
      creating build/lib.linux-x86_64-cpython-38/mpi4py/include/mpi4py
      copying src/mpi4py/include/mpi4py/mpi4py.MPI.h -> build/lib.linux-x86_64-cpython-38/mpi4py/include/mpi4py
      copying src/mpi4py/include/mpi4py/mpi4py.MPI_api.h -> build/lib.linux-x86_64-cpython-38/mpi4py/include/mpi4py
      copying src/mpi4py/include/mpi4py/mpi4py.h -> build/lib.linux-x86_64-cpython-38/mpi4py/include/mpi4py
      copying src/mpi4py/include/mpi4py/mpi4py.i -> build/lib.linux-x86_64-cpython-38/mpi4py/include/mpi4py
      copying src/mpi4py/include/mpi4py/mpi.pxi -> build/lib.linux-x86_64-cpython-38/mpi4py/include/mpi4py
      copying src/mpi4py/futures/__init__.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/__main__.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/_core.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/_lib.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/aplus.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/pool.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/futures/server.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/futures
      copying src/mpi4py/util/__init__.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/util
      copying src/mpi4py/util/dtlib.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/util
      copying src/mpi4py/util/pkl5.pyi -> build/lib.linux-x86_64-cpython-38/mpi4py/util
      running build_clib
      MPI configuration: [mpi] from 'mpi.cfg'
      checking for library 'lmpe' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -llmpe -o _configtest
      /home/syerawar_umass_edu/.conda/envs/DiffusionLM/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-38
      creating build/temp.linux-x86_64-cpython-38/src
      creating build/temp.linux-x86_64-cpython-38/src/lib-pmpi
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c src/lib-pmpi/mpe.c -o build/temp.linux-x86_64-cpython-38/src/lib-pmpi/mpe.o
      creating build/lib.linux-x86_64-cpython-38/mpi4py/lib-pmpi
      gcc -pthread -shared -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -L/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,-rpath=/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,--no-as-needed -Wl,--sysroot=/ -Wl,--no-as-needed build/temp.linux-x86_64-cpython-38/src/lib-pmpi/mpe.o -o build/lib.linux-x86_64-cpython-38/mpi4py/lib-pmpi/libmpe.so
      checking for library 'vt-mpi' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -lvt-mpi -o _configtest
      /home/syerawar_umass_edu/.conda/envs/DiffusionLM/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' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -lvt.mpi -o _configtest
      /home/syerawar_umass_edu/.conda/envs/DiffusionLM/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
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c src/lib-pmpi/vt.c -o build/temp.linux-x86_64-cpython-38/src/lib-pmpi/vt.o
      gcc -pthread -shared -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -L/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,-rpath=/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,--no-as-needed -Wl,--sysroot=/ -Wl,--no-as-needed build/temp.linux-x86_64-cpython-38/src/lib-pmpi/vt.o -o build/lib.linux-x86_64-cpython-38/mpi4py/lib-pmpi/libvt.so
      checking for library 'vt-mpi' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -lvt-mpi -o _configtest
      /home/syerawar_umass_edu/.conda/envs/DiffusionLM/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' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -lvt.mpi -o _configtest
      /home/syerawar_umass_edu/.conda/envs/DiffusionLM/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
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c src/lib-pmpi/vt-mpi.c -o build/temp.linux-x86_64-cpython-38/src/lib-pmpi/vt-mpi.o
      gcc -pthread -shared -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -L/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,-rpath=/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,--no-as-needed -Wl,--sysroot=/ -Wl,--no-as-needed build/temp.linux-x86_64-cpython-38/src/lib-pmpi/vt-mpi.o -o build/lib.linux-x86_64-cpython-38/mpi4py/lib-pmpi/libvt-mpi.so
      checking for library 'vt-hyb' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -lvt-hyb -o _configtest
      /home/syerawar_umass_edu/.conda/envs/DiffusionLM/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' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -lvt.ompi -o _configtest
      /home/syerawar_umass_edu/.conda/envs/DiffusionLM/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
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c src/lib-pmpi/vt-hyb.c -o build/temp.linux-x86_64-cpython-38/src/lib-pmpi/vt-hyb.o
      gcc -pthread -shared -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -L/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,-rpath=/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,--no-as-needed -Wl,--sysroot=/ -Wl,--no-as-needed build/temp.linux-x86_64-cpython-38/src/lib-pmpi/vt-hyb.o -o build/lib.linux-x86_64-cpython-38/mpi4py/lib-pmpi/libvt-hyb.so
      running build_ext
      MPI configuration: [mpi] from 'mpi.cfg'
      checking for dlopen() availability ...
      checking for header 'dlfcn.h' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/syerawar_umass_edu/.conda/envs/DiffusionLM/include/python3.8 -c _configtest.c -o _configtest.o
      success!
      removing: _configtest.c _configtest.o
      success!
      checking for library 'dl' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/syerawar_umass_edu/.conda/envs/DiffusionLM/include/python3.8 -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -Lbuild/temp.linux-x86_64-cpython-38 -ldl -o _configtest
      success!
      removing: _configtest.c _configtest.o _configtest
      checking for function 'dlopen' ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/syerawar_umass_edu/.conda/envs/DiffusionLM/include/python3.8 -c _configtest.c -o _configtest.o
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ _configtest.o -Lbuild/temp.linux-x86_64-cpython-38 -ldl -o _configtest
      success!
      removing: _configtest.c _configtest.o _configtest
      building 'mpi4py.dl' extension
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_DLFCN_H=1 -DHAVE_DLOPEN=1 -I/home/syerawar_umass_edu/.conda/envs/DiffusionLM/include/python3.8 -c src/dynload.c -o build/temp.linux-x86_64-cpython-38/src/dynload.o
      gcc -pthread -shared -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -L/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,-rpath=/home/syerawar_umass_edu/.conda/envs/DiffusionLM/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-38/src/dynload.o -Lbuild/temp.linux-x86_64-cpython-38 -ldl -o build/lib.linux-x86_64-cpython-38/mpi4py/dl.cpython-38-x86_64-linux-gnu.so
      checking for MPI compile and link ...
      gcc -pthread -B /home/syerawar_umass_edu/.conda/envs/DiffusionLM/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/syerawar_umass_edu/.conda/envs/DiffusionLM/include/python3.8 -c _configtest.c -o _configtest.o
      _configtest.c:2:10: fatal error: mpi.h: No such file or directory
          2 | #include <mpi.h>
            |          ^~~~~~~
      compilation terminated.
      failure.
      removing: _configtest.c _configtest.o
      error: Cannot compile MPI programs. Check your configuration!!!
      [end of output]

我应该如何解决这个 mpi4py 安装问题?

python pip conda mpi4py
1个回答
0
投票

此问题可能是由于 python 贬值的依赖项引起的。您可以尝试像这样安装库:

Python 3.8.0
(env) PS C:\Users\KIIT\Desktop\slideToSummary> pip install --no-cache-dir  mpi4py
Collecting mpi4py
  Downloading https://files.pythonhosted.org/packages/cf/9d/cce868ab0f5f983555204bbf8b61bd770742d1231b8f7050671726f8d8bc/mpi4py-3.1.6-cp38-cp38-win_amd64.whl (480kB)
     |████████████████████████████████| 481kB 3.3MB/s
Installing collected packages: mpi4py
Successfully installed mpi4py-3.1.6```
© www.soinside.com 2019 - 2024. All rights reserved.