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

相关推荐
樊小肆1 分钟前
DeepSeeker-Code源码导读10-代码智能tsHost
人工智能·agent
武子康3 分钟前
262K 跑过,128K 却被脚本拦下:A6000 跑分里的三种“失败”不能混为一谈
人工智能·llm·agent
盐焗鹌鹑蛋3 分钟前
【Linux】消息队列和信号量
linux
互联网志3 分钟前
机器人物理AI操作系统问世 多形态设备协同训练重构智能作业模式
人工智能·重构·机器人
Zguigo3 分钟前
【DL】神经网络学习目标|prediction|Loss|Gradient
人工智能·神经网络·学习
长江后浪博客7 分钟前
RIP 颜色计算原理:RGB→CMYK 转换与陶瓷喷墨色彩管理
人工智能·rip·颜色管理·陶瓷喷墨
2601_9669496512 分钟前
Python 量化数据质量校验:如何确保股票历史日线数据不存在缺失交易日?
开发语言·人工智能·爬虫·python·量化策略·量化·quantdash
circuitsosk14 分钟前
Python 文件读写与上下文管理器:with 语句为什么是最佳选择
java·服务器·python·文件操作·上下文管理器·contextlib
智者向内寻求力量17 分钟前
【记录】ubuntu 24.04 安装在levnoval PC上之后,蓝牙设备找不到解决方法
linux·服务器·ubuntu
whcyhhh18 分钟前
头歌实践教学平台:数据科学与大数据技术导论(七下)
大数据·数据库·python