按照官网的教程安装mmcv
官网链接:https://github.com/open-mmlab/mmcv/tree/v0.2.16
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
pip install -e . #安装轻量版本
MMCV_WITH_OPS=1 pip install -e . #安装完整版full version
在执行最后一步时出现如下错误:
Looking in indexes: http://pypi.douban.com/simple/
Obtaining file:///data2/likai/SOLO
ERROR: Command errored out with exit status 1:
command: /data2/likai/anaconda3/envs/solo/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/data2/likai/SOLO/setup.py'"'"'; __file__='"'"'/data2/likai/SOLO/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-r4mscmvu
cwd: /data2/likai/SOLO/
Complete output (10 lines):
/data2/likai/anaconda3/envs/solo/lib/python3.7/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at /opt/conda/conda-bld/pytorch_1623448224956/work/c10/cuda/CUDAFunctions.cpp:115.)
return torch._C._cuda_getDeviceCount() > 0
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/data2/likai/SOLO/setup.py", line 251, in <module>
sources=['src/compiling_info.cpp']),
File "/data2/likai/SOLO/setup.py", line 103, in make_cuda_ext
raise EnvironmentError('CUDA is required to compile MMDetection!')
OSError: CUDA is required to compile MMDetection!
No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda-10.1'
----------------------------------------
WARNING: Discarding file:///data2/likai/SOLO. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
原因:其实是mmcv的依赖项未建立,主要有:pytest-runner pytest addict numpy pyyaml yapf opencv-python
pip install pytest-runner pytest addict numpy pyyaml yapf opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
再次运行指令
pip install -e . #安装轻量版本
MMCV_WITH_OPS=1 pip install -e . #安装完整版full version
或者
python setup.py install
就可以正常安装了