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版本能不能正常运行。

相关推荐
mit6.8246 分钟前
archived
后端·python·flask
船长@8 分钟前
FastAPI 快速上手:从零基础到实操入门
python·ai·fastapi
环球科讯10 分钟前
金融赋能焕新居——建行广东江门分行启动家装补贴季助力消费升温
大数据·人工智能·物联网
手写码匠11 分钟前
华为云Flexus+DeepSeek征文|Agent 评测体系实战:用 DeepSeek-R1 当裁判,打造 Dify Agent 的自动化回归测试流水线
人工智能·深度学习·算法·aigc
用户2986985301414 分钟前
效率工具分享:3 款免费 Markdown 转 Word 在线转换器
人工智能·后端
河南博为智能科技有限公司18 分钟前
配电站房智能辅控一体化监控方案——基于壁挂式边缘计算网关,实现无人值守!
人工智能·边缘计算
2601_9628601519 分钟前
智慧城市企业 2027 排期:LEAP East 香港站同时验证亚太与沙特需求
人工智能·智慧城市
2401_8652616326 分钟前
亦唐科技(YIKTANG):创新引领国产贴片机发展,稳居行业领军地位
大数据·人工智能·物联网
阿部多瑞 ABU27 分钟前
私域道德的“立法”与公共秩序的失序——法律-道德异化悖论研究
大数据·人工智能
研华科技Advantech29 分钟前
【案例分享】从单点突破到全场景复制:研华赋能药机装备迈向高效合规新范式
大数据·人工智能·边缘计算·工业设备升级