Bug 1411685

Summary: Unable to create a Python3 virtualenv with python-virtualenv 1.10.1-3.el7
Product: Red Hat Enterprise Linux 7 Reporter: Felix Schwarz <fschwarz>
Component: python-virtualenvAssignee: Charalampos Stratakis <cstratak>
Status: CLOSED ERRATA QA Contact: Branislav Náter <bnater>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5-AltCC: cstratak, isenfeld, pviktori, tadej.j
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-virtualenv-1.10.1-4.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 18:15:57 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 Felix Schwarz 2017-01-10 09:54:23 UTC
# virtualenv --python=/usr/bin/python3 venv34
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in venv34/bin/python3
Also creating executable in venv34/bin/python
Failed to import the site module
Traceback (most recent call last):
  File "…/venv34/lib64/python3.4/site.py", line 67, in <module>
    import os
  File "…/venv34/lib64/python3.4/os.py", line 618, in <module>
    from _collections_abc import MutableMapping
ImportError: No module named '_collections_abc'

# rpm -q python-virtualenv
python-virtualenv-1.10.1-3.el7.noarch

# rpm -q python34
python34-3.4.5-3.el7.x86_64

Technically with a "pure" CentOS 7 this is not a problem (as it does not ship Python 3), the python34 above is from EPEL.


The problem was fixed upstream with https://github.com/pypa/virtualenv/commit/8ce3fcf153dd71c0e7f317161eefe2f6e7215ff0
(first released version with the fix is virtualenv 1.11)

Please consider patching/upgrading virtualenv.

Comment 2 Petr Viktorin (pviktori) 2017-01-12 16:32:41 UTC
As a workaround, you should be able to use Python3's venv module instead:

/usr/bin/python3 -m venv venv34

Comment 3 Felix Schwarz 2017-01-12 16:45:27 UTC
(In reply to Petr Viktorin from comment #2)
> As a workaround, you should be able to use Python3's venv module instead:
> 
> /usr/bin/python3 -m venv venv34

Unfortunately that does not work:

# /usr/bin/python3 -m venv venv34
Error: Command '['/home/pydicaapo/venv34/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

which is not really surprising because "-m venv" is basically what /usr/bin/pyvenv does...

Comment 4 Charalampos Stratakis 2017-02-06 17:38:24 UTC
This commit should be added on top as well to fix this issue:

https://github.com/pypa/virtualenv/commit/232ab405ab72bbb6b4032eb555dc4aa0a00c94f3

Comment 7 Branislav Náter 2017-04-26 09:44:42 UTC
Reproduced on python-virtualenv-1.10.1-3.el7.
Verfied on python-virtualenv-1.10.1-4.el7.

:: [  BEGIN   ] :: Create virtual environment :: actually running 'virtualenv --python=/usr/bin/python3 venv34'
Using base prefix '/usr'
New python executable in venv34/bin/python3
Also creating executable in venv34/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
Running virtualenv with interpreter /usr/bin/python3
:: [   PASS   ] :: Create virtual environment (Expected 0, got 0)


TCMS Test Results: https://tcms.engineering.redhat.com/run/303930/#caserun_15633848

Comment 8 errata-xmlrpc 2017-08-01 18:15:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1928