- 20200117
背景提要
在windows上安装mmdetection,选择torch==0.4.1版本,成功安装:
Python 3.5.5 |Anaconda, Inc.| (default, Apr 7 2018, 04:52:34) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mmdet
>>> import mmcv
在测试时候遇见下面bug:
from .. import deform_conv_cuda
ImportError: cannot import name 'deform_conv_cuda'
找不到解决原因只能尝试torch==1.1.0版本。
(此时愚蠢的我换了服务器进行安装)
bug 1
开始简单的pip安装,不论安装哪一个包,出现下面提示然后安装失败:
(torch110) G:\***\module>pip install tqdm
Collecting tqdm
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001736E93D0F0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tqdm/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001736E93D278>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tqdm/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001736E93D2B0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tqdm/
参考here,增加后缀之后安装成功:
pip install tqdm -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
每次加后缀太不美观,参考here,直接将pip请求连接更改:
"""
[global]
index-url = http://pypi.douban.com/simple
[install]
use-mirrors =true
mirrors =http://pypi.douban.com/simple/
trusted-host =pypi.douban.com
"""
bug 2
之后继续安装mmcv,出现以下错误:
(torch110) G:\***\module\mmcv>pip install mmcv
Looking in indexes: http://pypi.douban.com/simple
Collecting mmcv
Downloading http://pypi.doubanio.com/packages/44/73/fb25fb8929db78d92558580c84f15269c3e2e5f0d373dfc4e86e8bf4b7b3/mmcv-0.2.16.tar.gz (49kB)
|████████████████████████████████| 51kB 1.7MB/s
ERROR: Command errored out with exit status 1:
command: 'c:\users\****\anaconda3\envs\torch110\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\****\\AppData\\Local\\Temp\\pip-install-hb46z2h5\\mmcv\\setup.py'"'"'; __file__='"'"'C:\\Users\\****\\AppData\\Local\\Temp\\pip-install-hb46z2h5\\mmcv\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\****\AppData\Local\Temp\pip-install-hb46z2h5\mmcv\pip-egg-info'
cwd: C:\Users\****\AppData\Local\Temp\pip-install-hb46z2h5\mmcv\
Complete output (33 lines):
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
ERROR: Could not find a version that satisfies the requirement pytest-runner (from versions: none)
ERROR: No matching distribution found for pytest-runner
Traceback (most recent call last):
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg
subprocess.check_call(cmd)
File "c:\users\****\anaconda3\envs\torch110\lib\subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\\users\\****\\anaconda3\\envs\\torch110\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\****\\AppData\\Local\\Temp\\tmp6zred6ya', '--quiet', 'pytest-runner']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\****\AppData\Local\Temp\pip-install-hb46z2h5\mmcv\setup.py", line 109, in <module>
zip_safe=False)
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\setuptools\__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\setuptools\dist.py", line 721, in fetch_build_eggs
replace_conflicting=True,
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\pkg_resources\__init__.py", line 783, in resolve
replace_conflicting=replace_conflicting
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\pkg_resources\__init__.py", line 1066, in best_match
return self.obtain(req, installer)
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\pkg_resources\__init__.py", line 1078, in obtain
return installer(requirement)
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\setuptools\dist.py", line 777, in fetch_build_egg
return fetch_build_egg(self, req)
File "c:\users\****\anaconda3\envs\torch110\lib\site-packages\setuptools\installer.py", line 130, in fetch_build_egg
raise DistutilsError(str(e))
distutils.errors.DistutilsError: Command '['c:\\users\\****\\anaconda3\\envs\\torch110\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\****\\AppData\\Local\\Temp\\tmp6zred6ya', '--quiet', 'pytest-runner']' returned non-zero exit status 1.
----------------------------------------
ERROR: 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.
根据here,发现问题还是出在pip上,回头仔细查看pip.ini终于发现问题,mmcv安装过程的依赖包不被信任,导致安装失败,加上下面一句就可以解决:
[global]
index-url = http://pypi.douban.com/simple
trusted-host =pypi.douban.com
[install]
use-mirrors =true
mirrors =http://pypi.douban.com/simple/
trusted-host =pypi.douban.com