我正在尝试在Ubuntu 18.04实例上安装mpi4py。我已经安装了python3.6.5。
首先,我尝试sudo apt-get build-dep python-mpi4py
并得到:
正在阅读软件包列表...完成E:您必须在其中放入一些“源” URI 您的sources.list
然后,我尝试使用pip install mpi4py
进行简单安装。我收到一条很长的错误消息,并且在下面包括一些最重要的部分:
checking for library 'lmpe' ...
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
x86_64-conda_cos6-linux-gnu-cc in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
--------------------------------------------------------------------------
failure.
大多数库都会发生此故障。我只包括其中之一,而且
warning: build_clib: command '/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc' failed with exit status 1
warning: build_clib: building optional library "vt-mpi" failed
checking for library 'vt-hyb' ...
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
x86_64-conda_cos6-linux-gnu-cc in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
运行which mpcc
给出:
(tensorflow_p36) ubuntu@ip-172-31-35-200:~$ which mpicc
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc
如何将指定的编译器x86_64-conda_cos6-linux-gnu-cc添加到PATH中,以解决此错误?
答案 0 :(得分:0)
只需运行:
conda install -c anaconda mpi4py
,如图here所示。
还有Lidandro Dalcin的helpful comment:
我想您缺少mpich-mpicc软件包,这是一个 依赖于正确编译器的metapackage。你为什么要安装 mpi4py与点子?也许您只需要conda安装mpi4py (可在conda-forge频道中找到)?