近期新装了一台深度学习工作站,完成基本环境的配置。但是在Python多进程模块配置上遇到了以前也遇到过的问题,为了防止相似情况再次发生,特此记下。
问题描述:
执行以下命令:
pip install mpi4py
报错信息:
Collecting mpi4py==3.1.3
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。。。。。。(此处省略N行,只显示最后报错的关键信息)
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
pip3 install --upgrade pip
方法二:安装mpi依赖库
sudo apt updatesudo apt-get install libopenmpi-dev