当前位置:   article > 正文

Detectron2安装报错问题(本地cuda)_error: could not build wheels for detectron2, whic

error: could not build wheels for detectron2, which is required to install p

在安装Detectron2遇到了困难,如此报错:

 Could not build wheels for detection2,which is required to install pyproject.toml-based projects

或者是:

detectron2 RuntimeError: Error compiling objects for extension

或者是:

This is an issue with the package mentioned above, not pip.

排除版本问题:

首先去官方说明查看detection2要求:

Installation — detectron2 0.6 documentation

         简而言之:

        ①使用macOS或是Linux操作系统,且python版本≥3.7

        ②pytorch版本≥1.8,且安装对应版本的torchvision以及cuda

        ③若需要可安装opencv

        ④gcc与g++版本≥5.4,安装可以看别人的教程,注意更改默认版本

【仅供参考】本人系统Ubuntu20.04,其它版本:

        ①python = 3.7.0

        ②torch = 1.12.0,torchvision = 0.13.0,cuda = 10.2

        ③gcc&g++ = 5.4

问题解决:

①检查.bashrc

sudo gedit ~/.bashrc

②找到环境变量

可以看到我调用的本地cuda有问题,我安装的pytorch是cuda10.2版本的,那我就需要把路径改为正常路径(cuda-10.2),修改上述四个含有cuda-11.6的内容

③修改完保存关闭,并使更新立即生效

source ~/.bashrc

④查看当前使用的cuda版本

nvcc --version

如果显示为更换后的版本,即代表成功

⑤执行detectron安装命令

python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

⑥successfully,问题解决

另外,本文只针对本地cuda,如若使用pytorch自带cuda,请参考本站其他内容

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/575244
推荐阅读
相关标签
  

闽ICP备14008679号