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

相关推荐
红尘炼丹客5 分钟前
简析大模型(LLM)技术与量化交易
人工智能·金融
databook8 分钟前
让你的动画“活”过来:Manim 节奏控制指南 (Rate Functions)
后端·python·动效
samroom9 分钟前
langchain+ollama+Next.js实现AI对话聊天框
javascript·人工智能·langchain
西西o13 分钟前
面向Agentic Coding的未来:豆包Doubao-Seed-Code模型深度测评与实战
人工智能
瑶总迷弟20 分钟前
在centos上基于kubeadm部署单master的k8s集群
linux·kubernetes·centos
行者常至为者常成25 分钟前
基于LangGraph的自我改进智能体:Reflection与Reflexion技术详解与实现
人工智能
是小胡嘛32 分钟前
华为云CentOS系统中运行http服务器无响应
linux·服务器·c++·http·centos·华为云
菠菠萝宝1 小时前
【Java手搓RAGFlow】-9- RAG对话实现
java·开发语言·人工智能·llm·jenkins·openai
lhyzws1 小时前
CENTOS上的网络安全工具(二十九)GPU助力SPARK
linux·spark·gpu算力
学嵌入式的长路1 小时前
正点原子imx6ull移植lvgl v8.3及触摸屏调试
linux·驱动开发·lvgl·imx6ull·触摸屏