Error: externally-managed-environment

You neglected to ask a question. You cannot use pip in the debian installed and managed python3 unless you create and use a vitual environment, using either of the two methods specified. Otherwise, use apt install.

Also you cannot use pip install --user that I hope is a bug.

See error: externally-managed-environment · Issue #102134 · python/cpython · GitHub for a much more extensive answer to the same report on a cpython issue.

That is not about install --user. Its a system install.

Hmm… pip shouldn’t be printing the upgrade prompt on externally-managed environments actually.

Update: there’s now a tracking issue for this on pip.

No, that’s by design, because both system and user-installed packages can equally break packages in the system environment, and user-installed packages will in fact override those in the global env. See PEP 668 for some more details.

The error message is exactly the same, so to me, ‘same report’ is correct. The first answer to Python3 -m pip install --user broken in debian testing explains why the same message is appropriate to both command variations.

2 Likes

While we appreciate you’re trying to help, the very first reply (and the error message itself) already explained the problem, and a fully complete answer was already linked above.

Particularly with that in mind, I would ask that you please avoid spreading potentially dangerous advice that users are likely to copy and paste without fully understanding the consequences, at least without first presenting other better ways of solving this problem, explaining exactly what that flag does, and providing a clear disclaimer that they should not try it unless they know exactly what they are doing, are prepared to break things and none of the other options will work for their particular use case. Thanks.

I was also was surprised and confused by the pip message.

The point I had not picked up on is that it seems apart from Fedora using -s no one else is.
I’m a Fedora used mostly and knew that pip install --user on Fedora is safe to use.

That message did not make sense too me as I did not think I was doing what it told me was happening. e.g. I was not installing into the system as far as my understanding was.

The message is set by the distro in the EXTERNALLY-MANGED file, not by pip (unless the distro has not set one as it should, in which case the installer displays a fallback default message—but as this one references a specific distro, presumably that’s not what happened). Therefore, you should presumably bring that up with your distro. It does appear that essentially the example message from the PEP is being used, so perhaps the distro neglected to properly customize it?

Hi @vishalpa8 and welcome to the Python Discourse! While we appreciate you’re trying to help, as I mentioned to another user a few comments up, the very first reply (and the error message itself) already explained the problem, and a fully complete answer was already linked above.

Particularly with that in mind, I would ask that you please avoid spreading potentially dangerous advice that users are likely to copy and paste without fully understanding the consequences, at least without first presenting other better ways of solving this problem, explaining exactly what that flag does, and providing a clear disclaimer that they should not try it unless they know exactly what they are doing, are prepared to break things and none of the other options will work for their particular use case. Thanks.

As such I’ve unfortunately had to go ahead and hide your post, to avoid other users seeing it, copy-pasting and breaking their operating system. Sorry about that!

1 Like

Just to ensure anyone reading the thread doesn’t miss it, as others have noted above, see this GitHub post for a full explanation of why you’re seeing this message and what you should do about it. Thanks!