关于服务器:ubuntu安装mmcvfull看这一篇就够了

27次阅读

共计 3517 个字符,预计需要花费 9 分钟才能阅读完成。

背景

跑一个指标检测模型的 baseline,baseline 地址为 https://github.com/yuantn/MI-AOD
装置 mmcv-full 时出错

设施版本

baseline 要求的版本:GPU
Linux 开发平台(举荐应用 Ubuntu 和 CentOS,咱们在 Ubuntu 16.04、Ubuntu 18.04、CentOS 7.6 上测试过。)Anaconda3
Python 3.6+(举荐应用 Python 3.7,咱们用它测试过。)PyTorch 1.3+(举荐应用 PyTorch 1.6,咱们用它测试过。)CUDA 9.2+(举荐应用 CUDA 10.2,咱们用它测试过。如果你从源代码来搭建 PyTorch,那么 CUDA 9.0 也能够兼容。)CuDNN(可选项,咱们用 CuDNN 7.6.5 测试过。)GCC 5+(举荐应用 GCC 4.8.5, 5.5.0 and 7.5.0,咱们用它们测试过。)MMCV(十分举荐应用 MMCV 1.0.5,咱们用它测试过。它是惟一一个和 MMDetection 2.3.0 兼容的 MMCV 版本,这套 MI-AOD 代码是在该版本的 MMDetection 根底上编写的。
我这里版本比 baseline 要求的要高
ubuntu16.04,cuda 11.4(实验室备的)pytorch(1.10.0)torchvision(0.11.1)python3.7
GCC 5.5.0

正确装置步骤

补充我装置 pytorch 和 pytorchvision,cudatoolkit,mmcv-full 程序
因为实验室 cuda 版本已确定, 所以我的版本确定程序如下:
cuda(11.4)–>cudatoolkit(11.3)–>pytorch(1.10.0),pytorchvision(0.11.1)–>mmcv-full(1.4.2)

  1. 创立 python3.7 的虚拟环境 miaod 并激活
conda create -n miaod python=3.7 -y
conda activate miaod
  1. 装置 pytorch,torchvision 和 cudatoolkit
    不确定版本的话看这个 https://pytorch.org/
conda install pytorch cudatoolkit=11.3 torchvision -c pytorch

查看装置胜利

然而因为 conda 下载太慢,常常会断,而且我这里遇到了点问题,不晓得是不是镜像源配置问题(解决:过后把整个虚拟环境删掉,从新建了),所以能够采纳 wget 形式装置,这里不赘述.

  1. 装置 mmcv-full
    这里我执行了
pip install mmcv-full==1.4.2 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html

官网给出的命令如下:

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

其中,{}中的版本须要替换成对应版本,不晓得的能够查看 https://github.com/open-mmlab…

点击标记的中央,关上外面的网址,能够查看更多的 mmcv 版本

  1. 查看是否装置胜利
    pip list

我的神奇出错步骤

因为要 cuda 和 torch 版本要对应,所以参考链接

然而我的 cuda 是 11.4,所以自作聪明把 cu114 改成了 cu114,造孽呀,试了好屡次才发现错在一个版本数字上。
集体输出:

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

贴上局部谬误提醒

(miaod)gjs@xaserver:~$ pip install mmcv-full
Collecting mmcv-full
  Using cached mmcv-full-1.4.6.tar.gz (438 kB)
Requirement already satisfied: addict in ./anaconda3/envs/iaod/lib/python3.7/site-packages (from mmcv-full)                                                                     (2.4.0)
Requirement already satisfied: numpy in ./anaconda3/envs/miaod/lib/python3.7/site-packages (from mmcv-full)                                                                     (1.21.5)
Requirement already satisfied: packaging in ./anaconda3/envs/miaod/lib/python3.7/site-packages (from mmcv-fu                                                                    ll) (21.3)
Requirement already satisfied: Pillow in ./anaconda3/envs/miaod/lib/python3.7/site-packages (from mmcv-full)                                                                     (9.0.1)
Requirement already satisfied: pyyaml in ./anaconda3/envs/miaod/lib/python3.7/site-packages (from mmcv-full)                                                                     (6.0)
Requirement already satisfied: yapf in ./anaconda3/envs/miaod/lib/python3.7/site-packages (from mmcv-full) (0.32.0)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in ./anaconda3/envs/miaod/lib/python3.7/site-package                                                                    s (from packaging->mmcv-full) (3.0.7)
Building wheels for collected packages: mmcv-full
  Building wheel for mmcv-full (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/gjs/anaconda3/envs/miaod/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] ='"                                                                '"'/tmp/pip-install-j0pjsxbk/mmcv-full_d5394041d9d84b8a8b9d8c96a1f87280/setup.py'"'"'; __file__='"'"'/tmp/pip-in                                                                stall-j0pjsxbk/mmcv-full_d5394041d9d84b8a8b9d8c96a1f87280/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-mxbrufls
       cwd: /tmp/pip-install-j0pjsxbk/mmcv-full_d5394041d9d84b8a8b9d8c96a1f87280/
  Complete output (663 lines):
  running bdist_wheel
  /home/gjs/anaconda3/envs/miaod/lib/python3.7/site-packages/torch/utils/cpp_extension.py:381: UserWarning: Atte                                                                mpted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow di                                                                stutils backend.
    warnings.warn(msg.format('we could not find ninja.'))
  running build
  running build_py

致谢

感激崔大佬,让我对服务器的意识从 0.5 到 1,之后会缓缓增到到 10,甚至 100 的

正文完
 0