Bug 1420986

Summary: python3 -m virtualenv venv3 failed with error code 2
Product: [Fedora] Fedora Reporter: William Moreno <williamjmorenor>
Component: python3Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: bkabrda, cstratak, ishcherb, mcyprian, mhroncok, pviktori, rkuska, tomspur, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-10 19:36:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description William Moreno 2017-02-10 04:29:11 UTC
Description of problem:
I got a error creating a virtualenv with python3 -m virtualenv venv3

Version-Release number of selected component (if applicable):
python3-3.5.3-1.fc25.x86_64
python3-tools-3.5.3-1.fc25.x86_64

How reproducible:
Try to create a virtual with python3 -m virtualenv venv3

Steps to Reproduce:
1. python3 -m virtualenv venv3

Actual results:
Fails with a long traceback

Expected results:
Be able to create a virtualenv

Additional info:

Traceback:

python3 -m virtualenv venv3
Using base prefix '/usr'
New python executable in /home/wmoreno/Proyectos/venv3/bin/python3
Also creating executable in /home/wmoreno/Proyectos/venv3/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /home/wmoreno/Proyectos/venv3/bin/python3 - setuptools pip wheel:
  Collecting setuptools
  Using cached setuptools-34.1.1-py2.py3-none-any.whl
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/requests/packages/urllib3/response.py", line 228, in _error_catcher
    yield
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/requests/packages/urllib3/response.py", line 310, in read
    data = self._fp.read(amt)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/cachecontrol/filewrapper.py", line 49, in read
    data = self.__fp.read(amt)
  File "/usr/lib64/python3.5/http/client.py", line 448, in read
    n = self.readinto(b)
  File "/usr/lib64/python3.5/http/client.py", line 488, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib64/python3.5/socket.py", line 576, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib64/python3.5/ssl.py", line 937, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib64/python3.5/ssl.py", line 799, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib64/python3.5/ssl.py", line 583, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/commands/install.py", line 299, in run
    requirement_set.prepare_files(finder)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/req/req_set.py", line 370, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/req/req_set.py", line 587, in _prepare_file
    session=self.session, hashes=hashes)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/download.py", line 810, in unpack_url
    hashes=hashes
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/download.py", line 649, in unpack_http_url
    hashes)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/download.py", line 871, in _download_http_url
    _download_url(resp, link, content_file, hashes)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/download.py", line 595, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/utils/hashes.py", line 46, in check_against_chunks
    for chunk in chunks:
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/download.py", line 563, in written_chunks
    for chunk in chunks:
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/utils/ui.py", line 139, in iter
    for x in it:
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/download.py", line 552, in resp_read
    decode_content=False):
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/requests/packages/urllib3/response.py", line 353, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/requests/packages/urllib3/response.py", line 320, in read
    flush_decoder = True
  File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3.5/site-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/requests/packages/urllib3/response.py", line 233, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/lib64/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.5/site-packages/virtualenv.py", line 2327, in <module>
    main()
  File "/usr/lib/python3.5/site-packages/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/usr/lib/python3.5/site-packages/virtualenv.py", line 944, in create_environment
    download=download,
  File "/usr/lib/python3.5/site-packages/virtualenv.py", line 900, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python3.5/site-packages/virtualenv.py", line 795, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/wmoreno/Proyectos/venv3/bin/python3 - setuptools pip wheel failed with error code 2

https://paste.fedoraproject.org/552047/48670013

Comment 1 Iryna Shcherbina 2017-02-10 12:35:29 UTC
Hi William,

I am not able to reproduce the error you are facing with virtualenv and it seems network related.

Also consider using venv[0] in favour of virtualenv.

[0] https://docs.python.org/3.5/library/venv.html

Comment 2 Petr Viktorin (pviktori) 2017-02-10 12:40:30 UTC
The difference is that virtualenv downloads pip and its dependencies from PyPI (so it's vulnerable to network issues), while venv installs bundled (or, in Fedora's case, system-installed) copies of these that are already available locally.

Comment 3 William Moreno 2017-02-10 19:36:59 UTC
pyenv works fine, thanks