[Python-modules-team] Bug#897121: virtualenv: ImportError (requests.packages.urllib3.exceptions) when creating virtualenv

Alexander Clausen alex at gc-web.de
Sat Apr 28 16:44:25 BST 2018


Package: virtualenv
Version: 15.1.0+ds-1.1
Severity: important

Dear Maintainer,

when creating a virtualenv, the "Installing ..." step fails with the
following error:

    Installing setuptools, pkg_resources, pip, wheel...
      Complete output from command /tmp/testvenv/bin/python2 - setuptools pkg_resources pip wheel:
      Traceback (most recent call last):
      File "<stdin>", line 7, in <module>
      File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 21, in <module>
    ImportError: No module named requests.packages.urllib3.exceptions
    ----------------------------------------
    ...Installing setuptools, pkg_resources, pip, wheel...done.
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module>
        main()
      File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main
        symlink=options.symlink)
      File "/usr/lib/python3/dist-packages/virtualenv.py", line 992, in create_environment
        download=download,
      File "/usr/lib/python3/dist-packages/virtualenv.py", line 922, in install_wheel
        call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
      File "/usr/lib/python3/dist-packages/virtualenv.py", line 817, in call_subprocess
        % (cmd_desc, proc.returncode))
    OSError: Command /tmp/testvenv/bin/python2 - setuptools pkg_resources pip wheel failed with error code 1

This appears to be an error in vendoring somewhere (pip?). I tried to
pin down the root cause by editing the pip wheel: adding 

    import requests.packages.urllib3.exceptions

into
/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py
produces the following error message instead:

    Installing setuptools, pkg_resources, pip, wheel...
      Complete output from command /tmp/testvenv/bin/python2 - setuptools pkg_resources pip wheel:
      Traceback (most recent call last):
      File "<stdin>", line 7, in <module>
      File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 21, in <module>
      File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/__init__.py", line 97, in <module>
      File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/utils.py", line 24, in <module>
      File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/certs.py", line 15, in <module>
    ImportError: No module named certifi

So the cause appears to be a missing wheel for python-certifi?

Thanks,
Alexander

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages virtualenv depends on:
ii  python3             3.6.5-3
ii  python3-virtualenv  15.1.0+ds-1.1

virtualenv recommends no packages.

virtualenv suggests no packages.

-- no debconf information



More information about the Python-modules-team mailing list