인터넷이 끊겨있는 우분투(ubuntu)환경에서 virtualenv 를 실행하여 새로운 환경을 만들려 하였을 때, 에러가 발생했다.
python2 -m virtualenv venv
venv 라는 이름의 direcotry 에 가상 파이썬2 환경을 만드려 하는 명령이다.
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/home/me/myapp/venv277/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/home/me/myapp/venv277/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/home/me/myapp/venv277/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/home/me/myapp/venv277/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/home/me/myapp/venv277/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
timeout=timeout
File "/home/me/myapp/venv277/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/me/myapp/venv277/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
----------------------------------------
...Installing setuptools, pkg_resources, pip, wheel...done.
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 2375, in <module>
main()
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 724, in main
symlink=options.symlink)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 992, in create_environment
download=download,
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 922, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 817, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/me/myapp/venv277/bin/python2 - setuptools pkg_resources pip wheel failed with error code 2
한참 원인을 찾다가, 에러메시지를 다시 천천히 읽어보니, pip 모듈에서 requests 모듈을 통해 무언가 http 통신으로 어떤 파일을 받아오려고 한다는 것을 알아차렸다. 문제가 발생한 환경을 인터넷이 안 되는 환경이다.
검색하여보니 virtualenv 를 실행할 대, download 하여 패키지를 설치하는 시도를 하지 않도록 하는 옵션이 있어, 적용하여 가사환경 생성에 성공하였다.
python2 -m virtualenv --no-download venv
'프로그래밍 > Python' 카테고리의 다른 글
PIP pylint wrapt install 시 UnicodeDecodeError (1) | 2018.05.25 |
---|---|
[VS2013|PTVS] Python Tool for Visual Studio 가 동작하지 않았다. (0) | 2018.04.19 |
[Django] Django import LOCAL settings 문제. (0) | 2018.03.05 |
[Python|Django] 장고(django)에서 백만건을 가져오는 queryset이 느리다. (0) | 2018.02.12 |
[PYTHON3.6|PIP] in console_to_str return s.decode UnicodeDecodeError: 'utf-8' codec can't decode byte (0) | 2017.09.21 |