[Python-modules-team] Bug#956144: virtualenv: caching of debian wheels breaks pip-installed virtualenv

Anthony Sottile asottile at umich.edu
Tue Apr 7 20:54:04 BST 2020


I failed to include the error message in the report, sorry was a little
rushed

here's the output of the last command:

```
root at 378c3ad9bbf3:/# venv2/bin/pip install astpretty
Traceback (most recent call last):
  File "venv2/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/venv2/lib/python3.8/site-packages/pip/_internal/cli/main.py", line
10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File
"/venv2/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py",
line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File
"/venv2/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line
7, in <module>
    from pip._internal.cli import cmdoptions
  File
"/venv2/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line
24, in <module>
    from pip._internal.exceptions import CommandError
  File "/venv2/lib/python3.8/site-packages/pip/_internal/exceptions.py",
line 10, in <module>
    from pip._vendor.six import iteritems
ModuleNotFoundError: No module named 'pip._vendor.six'
```

On Tue, Apr 7, 2020 at 12:51 PM Anthony Sottile <asottile+debian at umich.edu>
wrote:

> Package: virtualenv
> Version: 20.0.16-1
> Severity: normal
> Tags: patch
>
> Reproduction:
>
> ```bash
> apt update && apt install -y --no-install-recommends virtualenv
> virtualenv venv
> venv/bin/pip install virtualenv
> venv/bin/virtualenv venv2
> venv2/bin/pip install astpretty
> ```
>
> This was originally reported here:
> https://github.com/pre-commit/pre-commit/issues/1383
>
> The root cause is virtualenv's appdata cache is poisoned by the debian
> patched
> wheels which results in all invocations by unpatched virtualenv failing by
> using debian's cache.  My proposal is to separate debian's cache from the
> normal name to prevent this collision.  Here's a patch to the installed
> code
> which fixes this issue:
>
> ```diff
> ---
> /usr/lib/python3/dist-packages/virtualenv/seed/via_app_data/via_app_data.py.old
>    2020-04-07 19:41:09.613187290 +0000
> +++
> /usr/lib/python3/dist-packages/virtualenv/seed/via_app_data/via_app_data.py2020-04-07
> 19:41:17.601187290 +0000
> @@ -18,7 +18,7 @@
>      def __init__(self, options):
>          super(FromAppData, self).__init__(options)
>          self.symlinks = options.symlink_app_data
> -        self.base_cache = self.app_data / "seed-app-data" / "v1.0.1"
> +        self.base_cache = self.app_data / "seed-app-data" /
> "v1.0.1.debian"
>
>      @classmethod
>      def add_parser_arguments(cls, parser, interpreter, app_data):
> ```
>
>
> -- System Information:
> Debian Release: bullseye/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 4.15.0-91-generic (SMP w/2 CPU cores)
> Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
> Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C
> (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: unable to detect
>
> Versions of packages virtualenv depends on:
> ii  python3-virtualenv  20.0.16-1
>
> virtualenv recommends no packages.
>
> virtualenv suggests no packages.
>
> -- no debconf information
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/python-modules-team/attachments/20200407/77d8290c/attachment.html>


More information about the Python-modules-team mailing list