Hide Forgot
# 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.
As a workaround, you should be able to use Python3's venv module instead: /usr/bin/python3 -m venv venv34
(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...
This commit should be added on top as well to fix this issue: https://github.com/pypa/virtualenv/commit/232ab405ab72bbb6b4032eb555dc4aa0a00c94f3
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
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