MMCV+ubuntu20.04+pytorch1.10+cu11.3/cu11.4安装踩坑记录
环境配置
cuda11.4(cuda11.x)
ubuntu20.04
python3.7/python3.8
mmcv/mmdet/mmpose/mmengine 依赖的其他wheel包对python版本有要求,安装过程中请注意!
1. pytorch1.10.x 安装
- 在官网找到和cuda版本对应的pytorch版本 https://pytorch.org/get-started/previous-versions/
- 如果需要其他版本可以直接到下载目录查找http://download.pytorch.org/whl/torch_stable.html
- 我使用的是
torch1.10.2+torchaudio-0.10.2+torchvision-0.11.3
2. MMCV 安装
前提:安装好对应版本的pytorch(1.10.x兼容1.10.0)
- 官方安装指导 https://mmcv.readthedocs.io/en/2.x/get_started/installation.html
- 我是用pip直接安装mmcv2.0.0rc4,离线wheel包下载链接:
https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html
3. MMPose相关安装、配置
mmdet、mmpose、mmengine在pypi仓库可以找到对应python版本的包,直接下载安装。
4. 问题记录
1. AssertionError: MMCV==1.7.1 is used but incompatible. Please install mmcv>=2.0.0rc4, <=2.1.0.
方案:卸载mmcv-full、mmcv,重新安装mmcv2.0.0rc4
如果仍然报错,可能是pytorch版本不对,参照第一节重新安装pytorch
2. NameError: name ‘init_detector’ is not defined
方案:参照第一节重新安装pytorch,如果问题没有解决再参照第二节重新安装mmcv