Skip to content

PEP 668 support breaks --user/--editable #11776

Closed
@stefanor

Description

@stefanor

Description

@obfusk filed Debian bug #1030335 about the implementation of PEP 668 support.

I think it's best if this is discussed here, with upstream involvement.
cc @geofft @doko42 @FFY00 @dstufft @uranusjr @ehashman @pradyunsg @kitterma who were involved in the PEP or pip in Debian.

Hi!

I just updated python3-pip and was greeted with a NEWS message about
PEP 668 support:

This version of pip introduces PEP 668 support. Debian's python3.11
interpreter will soon (>= 3.11.1-3) declare the installation to be
EXTERNALLY-MANAGED, instructing pip to disallow package installation outside
virtualenvs.

See: https://peps.python.org/pep-0668/

Practically, this means that you can't use pip to install packages outside a
virtualenv, on a Debian system, any more.

See /usr/share/doc/python3.11/README.venv for more details.
If that isn't available yet, check:
https://salsa.debian.org/cpython-team/python3/-/blob/master/debian/README.venv

Not being able to install packages system-wide seems like a good idea,
I fully support that.

But I often install the Python packages I'm developing under my own
user account with "pip install -e", which is also made impossible by
this change.

And I intentionally do not use virtualenvs for this because I want to
have all dependencies provided by Debian packages, not downloaded from
PyPI.

And as far as I can tell there is not even an option I can give to pip
to tell it to allow me to install to ~/.local anyway. PEP 668
mentions a --break-system-packages (as an example), but such an option
doesn't seem to actually exist.

  • FC

This bug is about a Debian-user-specific issue (not wanting to depend on PyPI), but I don't think this is something Debian should try to solve, alone.

When the PEP was drafted, we were assuming there'd be some sort of mechanism to override it (allow the user to break their system and keep both pieces), I quote:

The installer should have a way for the user to override these rules, such as a command-line flag --break-system-packages. This option should not be enabled by default and should carry some connotation that its use is risky.

That didn't make it into the implementation, so I suggested deleting the EXTERNALLY-MANAGED file in the documentation Debian is providing about this. It's not great, but it's about the only suggestion I can make:

https://salsa.debian.org/cpython-team/python3/-/blob/master/debian/README.venv

Does pip have any thoughts on providing an override mechanism?

There is some value in not having an override (we don't need to keep testing that all these schemes work, for one). But as we transition, we're going to be breaking use-cases...

Expected behavior

No response

pip version

23.0

Python version

3.11.1

OS

Debian GNU/Linux

How to Reproduce

  1. apt install python3-pip
  2. check out a python source package.
  3. pip install -e .

Output

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions