无法使用conda安装mpi4py并指定预安装的mpicc路径

无法使用conda安装mpi4py并指定预安装的mpicc路径

本文介绍了无法使用conda安装mpi4py并指定预安装的mpicc路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用以下方式安装mpi4py:

I have tried installing mpi4py with:

env MPICC=path/to/openmpi/bin/mpicc conda install -c anaconda mpi4py

但我收到此消息:

The following NEW packages will be INSTALLED:
  mpi                anaconda/linux-64::mpi-1.0-mpich
  mpi4py             anaconda/linux-64::mpi4py-3.0.3-py37h028fd6f_0
  mpich              anaconda/linux-64::mpich-3.3.2-hc856adb_0

似乎表明"MPICC = path/to/openmpi/bin/mpicc"已被忽略.

Which seems to show that "MPICC=path/to/openmpi/bin/mpicc" was ignored.

实际上,在使用mpich安装mpi4py并尝试使用mpirun -n 2 python mpi4pyTest.py运行以下简单代码之后:

Indeed, after installing mpi4py with mpich, and trying to run the following simple code with mpirun -n 2 python mpi4pyTest.py:

from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
print('Hello from processor {} of {}'.format(rank+1,size))

输出为:

Hello from processor 1 of 1
Hello from processor 1 of 1

我怎样才能让conda链接mpi4py与我自己的mpicc?它的位置是在PATH环境变量以及LD_LIBARY_PATH中设置的.

How can I get conda to link mpi4py with my own mpicc? Its location is setup in PATH environment variable, as well as LD_LIBARY_PATH.

最诚挚的问候.

推荐答案

conda install从存储库中提取预编译的二进制软件包及其依赖项.如果要使用自己的MPI实现构建mpi4py,请改用pip从源代码进行安装.您可以在Conda环境中使用pip.

conda install pulls precompiled binary packages and their dependencies from the repository. If you want mpi4py built with your own MPI implementation, use pip instead to install from source. You can use pip with Conda environments.

或者使用conda remove卸载所有软件包,然后使用pip(将MPICC环境变量指定为MPI C编译器)安装mpi4py,或者从新环境开始.

Either uninstall all packages using conda remove and then install mpi4py using pip (specifying the MPICC environment variable to your MPI C complier), OR start with a new environment.

这篇关于无法使用conda安装mpi4py并指定预安装的mpicc路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 00:32