[Python-modules-team] Bug#876145: python-pip: pip install --system as non-root shouldn't default --ignore-installed

Peter Amstutz peter.amstutz at curoverse.com
Tue Sep 19 01:21:31 UTC 2017


Source: python-pip
Version: 9.0.1-2
Severity: normal

Dear Maintainer,

When running "pip install --system" as a non-root user, the change in
set_user_default.patch forces the --ignore-installed flag to be enabled.

This has the effect of breaking pip for use cases that install packages as non-
root but don't use --user or virtualenv.  When dependencies are shared among
multiple packages, the --ignore-installed option causes pip to blindly install
the latest version of each dependency requested by each package, even if a
compatible package version is already installed, and even if this breaks the
requirement spec of some other package.  This results in package version
conflicts.

For example:

pip install pkg_A (requires pkg_B==1.0)
pip install pkg_C (requires pkg_B>=1.0)

Because of --ignore-installed, pkg_C ignores the existing pkg_B (which it is
otherwise compatible with) and installs the latest pkg_B==2.0, as a result this
breaks pkg_A.

Here's the relevant logic in pip/commands/install.py:

        default_user = True
        if running_under_virtualenv():
            default_user = False
        if os.geteuid() == 0:
            default_user = False

        cmd_opts.add_option(
            '-I', '--ignore-installed',
            dest='ignore_installed',
            action='store_true',
            default=default_user,
            help='Ignore the installed packages (reinstalling instead).')

My preferred fix would be that when the --system flag is set, it should retain
the default behavior of pip, and not interfere with the unrelated --ignore-
installed flag.

Thanks,
Peter



-- System Information:
Debian Release: 9.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)



More information about the Python-modules-team mailing list