mpi4py、pycocotools报错

安装 mpi4py 库时出现编译报错,报错信息为:

复制代码
 gcc -pthread -B /root/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/root/anaconda3/include/python3.7m -c _configtest.c -o _configtest.o
  _configtest.c:2:10: fatal error: mpi.h: No such file or directory
   #include <mpi.h>
            ^~~~~~~
  compilation terminated.
  failure.
  removing: _configtest.c _configtest.o
  error: Cannot compile MPI programs. Check your configuration!!!

sudo apt-get update

sudo apt install libopenmpi-dev

解决掉上面的报错问题,出现下面的

复制代码
collect2: error: ld returned 1 exit status                                                                                                                                                                                                                                      
failure.                                                                                                                                                                                                                                                                        
removing: _configtest.c _configtest.o                                                                                                                                                                                                                                           
error: Cannot link MPI programs. Check your configuration!!!            

参考

sudo apt install python3-mpi4py (但是不管用,又试了下conda)

conda install mpi4py (通过)

但是pycocotools报错

复制代码
/overlay/lib/python3.10/site-packages/numpy/core/include -I./common -I/data/anaconda3/envs/sd-webui/include/python3.10 -c ../common/maskApi.c -o build/temp.linux-x86_64-cpython-310/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
      gcc: error: ../common/maskApi.c: No such file or directory
      gcc: fatal error: no input files
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycocotools
Failed to build pycocotools

有人说 conda install Cython 但我不管用,你们可以试试。

pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

最后通过这个装了pycocotools 2.0版本,但要求是pycocotools==2.0.4,不过2.0.4死活不能装起,可以试试2.0版本能不能正常运行。

相关推荐
qqxhb31 分钟前
36|RAG 评测与回归:命中率、覆盖率、引用正确性
人工智能·数据挖掘·回归·覆盖率·命中率·正确性
神州数码云基地37 分钟前
DSPy + Parlant:从手动调优到自动编译的效率加速器
人工智能·深度学习·机器学习
一位代码37 分钟前
微软开源项目MarkitDown:一款将pdf/word/ppt等各类文件转换为Markdown格式的python工具
python
jcbut38 分钟前
在Linux上安装Kingbase 9
linux·kingbase·人大金仓·电科金仓
小此方2 小时前
Re:Linux系统篇(二十六)进程篇·十一:从底层原理到 exec* 家族:彻底搞懂 Linux 进程程序替换
linux·运维·服务器
云烟成雨TD7 小时前
Spring AI Alibaba 1.x 系列【69】Token 用量统计
java·人工智能·spring
十三画者7 小时前
【AI学习笔记】:DeepSeek 大模型本地部署与调用实战指南
人工智能
丁常彦-自媒体-常言道7 小时前
从首发4nm智驾芯片到兜底城市领航安全,比亚迪开启AI新征程
人工智能
Unbelievabletobe7 小时前
解决了股票api接口盘后数据更新慢的问题
大数据·开发语言·python