Skip to content

Disallow explicitly passing install-location-related arguments in --install-options #7309

@chrahunt

Description

@chrahunt

What's the problem this feature will solve?

Currently the --install-option parameter allows passing arbitrary arguments to setup.py for packages using the legacy-installation path. If any options/flags that control install location are passed, such as:

  • --exec-prefix
  • --home
  • --install-base
  • --install-data
  • --install-headers
  • --install-lib
  • --install-platlib
  • --install-purelib
  • --install-scripts
  • --prefix
  • --root
  • --user

then it causes issues. Not every package uses setup.py, so in the general case this causes legacy packages to be installed with the the scheme provided in --install-option and PEP 517/wheel packages to be installed with the scheme pip is aware of. This has already hit two users (#7253, #7240).

Pip knows how to use scheme information properly for PEP 517, wheel, and legacy installs. Enforcing that pip is the only one passing this kind of information will make the user experience more consistent.

Describe the solution you'd like

Explicitly fail pip install if --install-option includes any of the above arguments, whether provided on the command-line or in a requirements file.

In addition to the consistent user experience, this would also allow pip to pass the more explicit

  • --install-{purelib,platlib,headers,scripts,data} (for install)
  • --install-dir, --script-dir (for install -e)

to setup.py instead of the current --prefix, --home, --root, --user, and --install-headers.

This may also be required to implement PEP 582 (__pypackages__) since doing legacy installs to a plain lib directory isn't possible with the current arguments being passed to setup.py, and passing an explicit --install-lib would break any usages of the other arguments in --install-option.

IMO this could be implemented without deprecation because the current behavior demonstrated in #7253 and #7240 causes failures in non-obvious ways, and the remediation is simple in most cases - just pass the parameters to pip instead.

Alternative Solutions

  • do nothing - as we accumulate more features that conflict with these arguments being passed to --install-option we will get more support tickets. These will taper off eventually as people stop using these flags in order to install non-legacy packages. We eventually forget that the user can pass these options, and implement new features without worrying about it.
  • automatically determine a scheme based on --install-option - this defeats the purpose of having pip-level arguments
  • only fail the install if the scheme in --install-option conflicts with the one specified at the pip level - this is more friendly, but I feel that it would also be more confusing and add to the implementation burden in pip (reconciling --install-option across different packages in a requirements file)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    !release blockerHold a release until this is resolvedC: cliCommand line interface related things (optparse, option grouping etc)kind: backwards incompatibleWould be backward incompatibleproject: setuptoolsRelated to setuptoolstype: deprecationRelated to deprecation / removal.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions