【Ubuntu pip安装mpi4py时报错】
问题:描述问题
pip install mpi4py 报错如下:
/home/daiwenbin/anaconda3/envs/chatglm3_multi/compiler_compat/ld: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so: undefined reference to `opal_list_t_class'
collect2: error: ld returned 1 exit status
failure.
removing: _configtest.c _configtest.o
error: Cannot link 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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mpi4py)
解决方法:
需要把/home/daiwenbin/anaconda3/envs/chatglm3_multi/compiler_compat/ld这个库删除掉,才可以。为了不影响以后的其他程序,建议先备份,执行以下代码。
cp /home/daiwenbin/anaconda3/envs/chatglm3_multi/compiler_compat/ld /home/daiwenbin/anaconda3/envs/chatglm3_multi/compiler_compat/ld.backup
然后再删除:
rm /home/daiwenbin/anaconda3/envs/chatglm3_multi/compiler_compat/ld
就可以安装mpi4py了。