硬件环境:
1、显卡:2080Ti 2、CUDA环境:cuda11.1
虚拟环境:
1、python:3.8 2、pytorch:1.10.1+cu111 3、torchvision :0.11.2+cu111
附上pytorch、torchvision对应cuda版本安装命令(以cuda11.1为例):
官方链接:Previous PyTorch Versions | PyTorch
# CUDA 11.1
pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html
切记:安装环境条件一定要按照detectron2官方来:
问题描述:
运行 python -m pip install -e detectron2,安装时中途出现报错:
Installing collected packages: detectron2 ? Running setup.py develop for detectron2 ? ? ERROR: Command errored out with exit status 1: ? ? ?command: /opt/conda/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/user-data/DynamicHead-master/detectron2/setup.py'"'"'; __file__='"'"'/user-data/DynamicHead-master/detectron2/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'"'"'))' develop --no-deps ? ? ? ? ?cwd: /user-data/DynamicHead-master/detectron2/ ? ? Complete output (17 lines): ? ? running develop ? ? running egg_info ? ? writing detectron2.egg-info/PKG-INFO ? ? writing dependency_links to detectron2.egg-info/dependency_links.txt ? ? writing requirements to detectron2.egg-info/requires.txt ? ? writing top-level names to detectron2.egg-info/top_level.txt ? ? reading manifest file 'detectron2.egg-info/SOURCES.txt' ? ? adding license file 'LICENSE' ? ? writing manifest file 'detectron2.egg-info/SOURCES.txt' ? ? running build_ext ? ? /opt/conda/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. ? ? ? warnings.warn( ? ? /opt/conda/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. ? ? ? warnings.warn( ? ? /opt/conda/lib/python3.8/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 4.0.0-unsupported is an invalid version and will not be supported in a future release ? ? ? warnings.warn( ? ? error: [Errno 2] No such file or directory: "'/usr/local/cuda'/bin/nvcc" ? ? ---------------------------------------- ERROR: Command errored out with exit status 1: /opt/conda/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/user-data/DynamicHead-master/detectron2/setup.py'"'"'; __file__='"'"'/user-data/DynamicHead-master/detectron2/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'"'"'))' develop --no-deps Check the logs for full command output.
找了很多文章,更新了很多包,但是都没有效果。最终发现原因为nvcc的路径有问题:
? error: [Errno 2] No such file or directory: "'/usr/local/cuda'/bin/nvcc"
?解决方案:
输入命令行:
export CUDA_HOME=/usr/local/cuda
最终安装成功!!!
?可能有用的参考链接:
?https://blog.csdn.net/qq_39031960/article/details/106211878
?https://blog.csdn.net/m0_37661841/article/details/108318364
?https://blog.csdn.net/chen645096127/article/details/111563985
|