安装和使用mmdetection中遇到的一些问题:

    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'mmcv._ext'

这是安装mmcv,而不是安装mmcv-full导致功能不全的问题,pip install mmcv-full时,还有下面这种情况:

 Building wheel for mmcv-full (setup.py) ... errorERROR: Command errored out with exit status 1:command: /home/xiejun/anaconda3/envs/xiejun/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5sje9kee/mmcv-full_d11bcf00f28c4d2cab43de59499a7362/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5sje9kee/mmcv-full_d11bcf00f28c4d2cab43de59499a7362/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-c1qginh5cwd: /tmp/pip-install-5sje9kee/mmcv-full_d11bcf00f28c4d2cab43de59499a7362/
.
..
...
Failed to build mmcv-full
Installing collected packages: mmcv-fullRunning setup.py install for mmcv-full ... errorERROR: Command errored out with exit status 1:command: /home/xiejun/anaconda3/envs/xiejun/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5sje9kee/mmcv-full_d11bcf00f28c4d2cab43de59499a7362/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5sje9kee/mmcv-full_d11bcf00f28c4d2cab43de59499a7362/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9jhxpj3o/install-record.txt --single-version-externally-managed --compile --install-headers /home/xiejun/anaconda3/envs/xiejun/include/python3.7m/mmcv-full
.
.
.
RuntimeError: Error compiling objects for extension----------------------------------------
ERROR: Command errored out with exit status 1: /home/xiejun/anaconda3/envs/xiejun/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5sje9kee/mmcv-full_d11bcf00f28c4d2cab43de59499a7362/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5sje9kee/mmcv-full_d11bcf00f28c4d2cab43de59499a7362/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9jhxpj3o/install-record.txt --single-version-externally-managed --compile --install-headers /home/xiejun/anaconda3/envs/xiejun/include/python3.7m/mmcv-full Check the logs for full command output.

解决mmcv的安装问题,可以看这篇博客,这是我整理的在ubuntu中安装mmdetection成功配置的过程:https://blog.csdn.net/qq_44442727/article/details/113444207
我安装的时候,一开始我是pip install mmcv 很顺利就装完了,但是一运行就报错:ModuleNotFoundError: No module named ‘mmcv._ext’
官网也有提到mmcv功能不全,最好装mmcv-full,我后面是卸载了mmcv,安装mmcv-full.
mmcv-full的安装先要查询版本是否匹配,这个看官网:https://github.com/open-mmlab/mmcv

我的torch版本是1.7.1+cu101,所以找到torch1.7和cuda相交位置的“install”点开黑色三角形,可以看到指令:

pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html

上面指令中{mmcv_version}是待定的,需要具体确定,这时结合mmdetection的版本,如下图,因为我安装的是最新版的mmdetection,已经到了2.8.0版本了,mmcv-full的版本要求在>=1.2.4,<1.3于是我选择1.2.4版本。

安装指令具体为:

pip install mmcv-full==1.2.4 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html

完成后,这样就顺利安装好了。主要还是一个版本问题,mmdetection的版本+cuda的版本+显卡驱动的版本,版本对应上了,按上述方法安装,基本没有问题。

————————————————
版权声明:本文为CSDN博主「清梦枕星河~」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_44442727/article/details/113444207

还碰到的一个问题是:

OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA.

这个就是在电脑上安装了cuda,但是没有添加环境变量,库在调用的过程中找不到路径,没法调用,就报错了。解决办法就是添加环境变量:

vim ~/.bashrc

进入环境变量配置文件:

按“E”进行编辑,添加如下内容至文末:

export CUDA_HOME=/usr/local/cuda
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

再安Esc改变模式,保存编辑退出,指令是(:wq)
退出后,进行更新:

source ~/.bashrc

可以使用如下指令进行验证:

cat /proc/driver/nvidia/version

结果是:

NVRM version: NVIDIA UNIX x86_64 Kernel Module  435.21  Sun Aug 25 08:17:57 CDT 2019
GCC version:  gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

输入:

nvcc -V

结果:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

这就可以查询到cuda的信息了,成功添加好了环境变量。

Building wheel for mmcv-full (setup.py) ... error和OSError: CUDA_HOME environment variable is not set相关推荐

  1. Building wheel for TA-Lib (setup.py) ... error / ERROR: Failed building wheel for TA-Lib

    Ubuntu18.04 正常的可以Building wheels for collected packages: TA-Lib,所以问题原因:没有wheel for TA-Lib ,网上的大部分都是介 ...

  2. Building wheel for wrapt (setup.py) ... error

    去这里 here 找到相应报错的未安装的库whl文件下载 pip命令安装 以我确实wrapt为例子 C:\Windows\system32>pip install C:\Users\88304\ ...

  3. Building wheel for wrapt (setup.py) ... error的解决办法(图文)

    描述 安装python库有时会遇到安装失败的情况.这让我们很难受,下面是一种解决办法供大家参考,我们可以换一种方法安装,比如从官网下载来安装.下面是详细步骤; 一. python下载库官网:kou n ...

  4. 成功解决Building wheels for collected packages: dlib Running setup.py bdist_wheel for dlib ... error

    成功解决Building wheels for collected packages: dlib   Running setup.py bdist_wheel for dlib ... error 目 ...

  5. Failed building wheel for scandir 解决方案

    unbuntu 16.04 运行 pip install jupyter --upgrade 的时候出现了下面的错误 Failed building wheel for scandir Running ...

  6. Failed building wheel for netifaces

    目录 文章目录 目录 问题 解决 问题 安装 OpenStackClient 的时候发现问题: Failed building wheel for netifaces Running setup.py ...

  7. ERROR: Failed building wheel for box2d-py 解决方法

    当我们在一个全新的Python环境中构建一个AI/ML项目时,往往会在pip install -r requirements.txt阶段遇到这样一个错误: Building wheel for box ...

  8. 你真的了解python中的setup.py吗?

    在了解setup.py之前,有必要介绍一下python库分发打包的前世今生. 一. 为什么需要对项目分发打包? 平常我们习惯了使用 pip 来安装一些第三方模块,这个安装过程之所以简单,是因为模块开发 ...

  9. mayavi安装踩坑: Building wheel for mayavi (setup.py) ...

    安装mayavi的时候,当长时间卡在Building wheels for collected packages: mayavi   Building wheel for mayavi (setup. ...

最新文章

  1. Swift之SDWebImage第三方框架
  2. 【Linux】ps命令
  3. 【转】mybatis实战教程(mybatis in action)之八:mybatis 动态sql语句
  4. OO Unit 3 JML
  5. HT For Web 拓扑图背景设置
  6. 单片机小白学步系列(四) 模拟电路、传统数字电路与单片机
  7. 为什么要用Redis?
  8. Java成神之路——CGLIB使用
  9. 小 C 的数学(math)详解
  10. 在CentOS7上安装MySQL的心路历程
  11. Fast-paced Multiplayer
  12. 胃肠道微生物与癌症有关
  13. Android app界面设计工具AppInventor初体验
  14. dom4j解析XML入门指北
  15. 入过滤(Ingress Filtering)
  16. 【综述】机器视觉中的3D传感器
  17. html调用腾讯地图定位当前位置,vue web项目中调用腾讯地图API获取当前位置的经纬度...
  18. cpu上干硅脂怎么清理_安装CPU或者清理灰尘时CPU导热硅脂的使用方法及注意事项...
  19. 鸿蒙不支持手机,阻碍鸿蒙2.0上不了手机的问题找到了,别再埋怨华为
  20. c语言商品库存管理系统,[源码和文档分享]基于C++实现的物品库存管理系统

热门文章

  1. vue.js语法和常用指令
  2. Jeewx-api 1.1 版本发布,微信极速 SDK
  3. redis主从的配置和使用
  4. Linux进程实践(2) --僵尸进程与文件共享
  5. MySQL 在高并发下的 订单撮合 系统使用 共享锁 与 排他锁 保证数据一致性
  6. NOIP2017 列队——动态开点线段树
  7. Thinkphp5 请求报错
  8. Eclipse安装Rust插件 (Ubuntu)
  9. RE2正则表达式引擎资料
  10. SQLSERVER压缩数据文件的用处有多大