Comment 0 for bug 1935882

Revision history for this message
Ben Bariteau (benbariteau) wrote :

I reproduced this in a docker image (ubuntu:20.04)

Reproduction steps:
1) install `virtualenv` and `pypy`
2) run `virtualenv --python pypy venv`
3) run `venv/bin/pip`
This fails with this error output:
Traceback (most recent call last):
  File "venv/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/venv/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/venv/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/venv/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/venv/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
    from pip._internal.exceptions import CommandError
  File "/venv/site-packages/pip/_internal/exceptions.py", line 10, in <module>
    from pip._vendor.six import iteritems
ImportError: No module named pip._vendor.six

This should have printed out the usage information for pip.

I tried working around this by running `virtualenv --python pypy --download venv`. This allows running just `venv/bin/pip` to succeed, but a typical real usage of it fails like this:
# venv/bin/pip install requests
DEPRECATION: pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting requests
  Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
     |################################| 61 kB 8.8 MB/s
Collecting chardet<5,>=3.0.2
  Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
     |################################| 178 kB 26.8 MB/s
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
     |################################| 58 kB 9.8 MB/s
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.6-py2.py3-none-any.whl (138 kB)
     |################################| 138 kB 43.6 MB/s
Collecting certifi>=2017.4.17
  Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
     |################################| 145 kB 48.1 MB/s
Installing collected packages: chardet, idna, urllib3, certifi, requests
ERROR: Exception:
Traceback (most recent call last):
  File "/venv/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    status = self.run(options, args)
  File "/venv/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/venv/site-packages/pip/_internal/commands/install.py", line 404, in run
    pycompile=options.compile,
  File "/venv/site-packages/pip/_internal/req/__init__.py", line 90, in install_given_reqs
    pycompile=pycompile,
  File "/venv/site-packages/pip/_internal/req/req_install.py", line 824, in install
    requested=self.user_supplied,
  File "/venv/site-packages/pip/_internal/operations/install/wheel.py", line 845, in install_wheel
    requested=requested,
  File "/venv/site-packages/pip/_internal/operations/install/wheel.py", line 719, in _install_wheel
    assert os.path.exists(pyc_path)
AssertionError

This should have installed the requests package, instead of failing.

It's worth noting this seems to work with cpython. I specifically tried with python2.7 and the default python3 (python3.8). Using pypy3 fails in the same way.

Release info:
# lsb_release -rd
Description: Ubuntu 20.04.2 LTS
Release: 20.04