Support redirection to the system installer for system packages · Issue #1051 · pypa/pip (original) (raw)

Virtual environments and --user installations are entirely pip's domain. The same is also true for a custom install of Python. However, for the system Python (provided by the OS vendor), it is desirable for pip to be able to redirect an install request to the system package manager, and only proceed with a direct install from PyPI if no system package is available. Installing arbitrary packages from PyPI can have unpredictable effects on system stability, especially on operating systems like RHEL which deliberately avoid backwards incompatible upgrades to system packages.

What I am thinking here is to rely on the fact that OS vendors are able to patch their system pip install, so rather than a complex plugin system, just have a snippet somewhere in pip like the following:

def install_platform_dists(*installspecs):
    # Linux distro vendors are expected to patch this appropriately
    # for their own packaging policies
    # The passed in dist specifiers are installation specifiers of the form
    # described in PEP 426
    # It should return an iterable of all Python dists made available as a result of
    # handling the request
    return ()

(Note: to be clear, this isn't a prerequisite for bundling pip with Python 3.4 - it's just something I think we should be looking at long term to reduce the scope for conflict between pip and system package management tools. If pip transparently redirects to yum or apt-get when appropriate, then Pythonistas can use the pip commands regardless of distro, but automatically get yum and apt packages when they meet the constraints)