我正在尝试在MacBook M1中安装mpi4py。我正在学习MPI,我想在我的机器上测试一个基本的“hello world”python程序。然而,我面临着安装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 metadata (pyproject.toml) ... done Building wheels for collected packages: mpi4py 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 ╰─> [156 lines of output]
running bdist_wheel
running build
running build_src
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-cpython-39
creating build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/run.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/bench.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/__main__.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
creating build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_base.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/server.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_core.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/pool.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/aplus.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/__main__.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_lib.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
creating build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/pkl5.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/dtlib.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/py.typed -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/__main__.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/__init__.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/run.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/bench.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/MPI.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/dl.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/__init__.pxd -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/libmpi.pxd -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
copying src/mpi4py/MPI.pxd -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py
creating build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/include
creating build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi4py.MPI.h -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi4py.MPI_api.h -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi4py.h -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi4py.i -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/include/mpi4py/mpi.pxi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/include/mpi4py
copying src/mpi4py/futures/__main__.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/__init__.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_core.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/aplus.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/server.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/pool.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/futures/_lib.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/futures
copying src/mpi4py/util/__init__.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/dtlib.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/util
copying src/mpi4py/util/pkl5.pyi -> build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/util
running build_clib
MPI configuration: [mpi] from 'mpi.cfg'
MPI C compiler: /Users/sindhuja/opt/anaconda3/bin/mpicc
MPI C++ compiler: /Users/sindhuja/opt/anaconda3/bin/mpicxx
MPI F compiler: /Users/sindhuja/opt/anaconda3/bin/mpifort
MPI F90 compiler: /Users/sindhuja/opt/anaconda3/bin/mpif90
MPI F77 compiler: /Users/sindhuja/opt/anaconda3/bin/mpif77
checking for library 'lmpe' ...
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c _configtest.c -o
_configtest.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
failure.
removing: _configtest.c _configtest.o
building 'mpe' dylib library
creating build/temp.macosx-10.9-x86_64-cpython-39
creating build/temp.macosx-10.9-x86_64-cpython-39/src
creating build/temp.macosx-10.9-x86_64-cpython-39/src/lib-pmpi
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c src/lib-pmpi/mpe.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/lib-pmpi/mpe.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
warning: build_clib: command '/Users/sindhuja/opt/anaconda3/bin/mpicc' failed with exit code 127
warning: build_clib: building optional library "mpe" failed
checking for library 'vt-mpi' ...
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c _configtest.c -o
_configtest.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
failure.
removing: _configtest.c _configtest.o
checking for library 'vt.mpi' ...
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c _configtest.c -o
_configtest.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
failure.
removing: _configtest.c _configtest.o
building 'vt' dylib library
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c src/lib-pmpi/vt.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/lib-pmpi/vt.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
warning: build_clib: command '/Users/sindhuja/opt/anaconda3/bin/mpicc' failed with exit code 127
warning: build_clib: building optional library "vt" failed
checking for library 'vt-mpi' ...
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c _configtest.c -o
_configtest.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
failure.
removing: _configtest.c _configtest.o
checking for library 'vt.mpi' ...
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c _configtest.c -o
_configtest.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
failure.
removing: _configtest.c _configtest.o
building 'vt-mpi' dylib library
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c src/lib-pmpi/vt-mpi.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/lib-pmpi/vt-mpi.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
warning: build_clib: command '/Users/sindhuja/opt/anaconda3/bin/mpicc' failed with exit code 127
warning: build_clib: building optional library "vt-mpi" failed
checking for library 'vt-hyb' ...
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c _configtest.c -o
_configtest.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
failure.
removing: _configtest.c _configtest.o
checking for library 'vt.ompi' ...
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c _configtest.c -o
_configtest.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
failure.
removing: _configtest.c _configtest.o
building 'vt-hyb' dylib library
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -c src/lib-pmpi/vt-hyb.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/lib-pmpi/vt-hyb.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
warning: build_clib: command '/Users/sindhuja/opt/anaconda3/bin/mpicc' failed with exit code 127
warning: build_clib: building optional library "vt-hyb" failed
running build_ext
MPI configuration: [mpi] from 'mpi.cfg'
MPI C compiler: /Users/sindhuja/opt/anaconda3/bin/mpicc
MPI C++ compiler: /Users/sindhuja/opt/anaconda3/bin/mpicxx
MPI F compiler: /Users/sindhuja/opt/anaconda3/bin/mpifort
MPI F90 compiler: /Users/sindhuja/opt/anaconda3/bin/mpif90
MPI F77 compiler: /Users/sindhuja/opt/anaconda3/bin/mpif77
checking for dlopen() availability ...
checking for header 'dlfcn.h' ...
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64
-I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64
-I/Users/sindhuja/opt/anaconda3/include/python3.9 -c _configtest.c -o _configtest.o
success!
removing: _configtest.c _configtest.o
success!
checking for library 'dl' ...
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64
-I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64
-I/Users/sindhuja/opt/anaconda3/include/python3.9 -c _configtest.c -o _configtest.o
clang -flat_namespace -undefined suppress _configtest.o -Lbuild/temp.macosx-10.9-x86_64-cpython-39 -ldl -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
checking for function 'dlopen' ...
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64
-I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64
-I/Users/sindhuja/opt/anaconda3/include/python3.9 -c _configtest.c -o _configtest.o
clang _configtest.o -Lbuild/temp.macosx-10.9-x86_64-cpython-39 -ldl -o _configtest
success!
removing: _configtest.c _configtest.o _configtest
building 'mpi4py.dl' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64
-I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -DHAVE_DLFCN_H=1
-DHAVE_DLOPEN=1 -I/Users/sindhuja/opt/anaconda3/include/python3.9 -c src/dynload.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/dynload.o
clang -bundle -undefined dynamic_lookup -Wl,-rpath,/Users/sindhuja/opt/anaconda3/lib -L/Users/sindhuja/opt/anaconda3/lib -L/Users/sindhuja/opt/anaconda3/lib -Wl,-rpath,/Users/sindhuja/opt/anaconda3/lib -L/Users/sindhuja/opt/anaconda3/lib build/temp.macosx-10.9-x86_64-cpython-39/src/dynload.o
-Lbuild/temp.macosx-10.9-x86_64-cpython-39 -ldl -o build/lib.macosx-10.9-x86_64-cpython-39/mpi4py/dl.cpython-39-darwin.so
checking for MPI compile and link ...
/Users/sindhuja/opt/anaconda3/bin/mpicc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64 -I/Users/sindhuja/opt/anaconda3/include -fPIC -O2 -isystem /Users/sindhuja/opt/anaconda3/include -arch x86_64
-I/Users/sindhuja/opt/anaconda3/include/python3.9 -c _configtest.c -o _configtest.o
/Users/sindhuja/opt/anaconda3/bin/mpicc: line 301: x86_64-apple-darwin13.4.0-clang: command not found
failure.
removing: _configtest.c _configtest.o
error: Cannot compile MPI programs. Check your configuration!!!
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for mpi4py Failed to build mpi4py ERROR: Could not build wheels for mpi4py, which is required to install pyproject.toml-based projects
我已经下载了轮子和升级的pip,但是没有任何运气。有人能告诉我哪里出错了吗?提前感谢!
尝试使用自制软件安装:
brew install mpi4py