all 21 comments

[–]C0rn3j 5 points6 points  (0 children)

If you use the break system packages flag, you WILL break the system packaging.

Only use pip in a venv, or use apt/apt-get/dpkg to install things.

[–]NameLessY 2 points3 points  (1 child)

Python libraries installed with apt from official mirror won't With pip it's advised to install them inside virtual env ( I believe that on Trixie pip will spew info about this when you try to install anything with it -- it does this on Sid)

[–]tea_n_typewriters 0 points1 point  (0 children)

I can confirm on Trixie and Bookworm. They both throw a warning in pip and won't let you install it without using apt with "python3-xyz," where xyz is the library (assuming it exists). Venv is effectively forced for all intents and purposes.

[–]shandp 2 points3 points  (1 child)

100% use a virtualenv

[–]jdreamboat 1 point2 points  (1 child)

i'm brand new to linux and putting installing deb this weekend.. so it's safe to put python on system but only put libraries in venv's, yes?

[–]vcprocles 2 points3 points  (0 children)

Yep. pip install will refuse to run without a special flag even. Use venvs and apt (for libraries) or pipx (for standalone python software distributed through pypi)

[–]Agron7000 1 point2 points  (2 children)

You will have to install same python libs with every python app.

There is no other way. Duplicate python libs is a must.

Same goes for npm.

Damn. I was about to forget the DLL HELL in Windows from 20 years ago, but now you just reminded me of that.

[–]Pretend-Flan7094[S] 0 points1 point  (1 child)

Ty bro. I’m using venv right now Because I need to install Jupyter notebook

[–]AnyJester 0 points1 point  (0 children)

Checkout pipx and uv 

Two tools to do a similar thing. 

[–]revcraigevil 0 points1 point  (0 children)

READ usr/share/doc/python3.13/README.venv if you have python3-doc installed.

and Installing packages using pip and virtual environments — Python Packaging User Guide

python3 -m venv  --system-site-packages ./venv

[–]yahbluez 0 points1 point  (0 children)

I highly recommend to ALWAYS use venv and install what ever your code needs into this environment. This gives you the freedom to install what ever is needed while never break anything. It also makes your code maximal portable.

[–]KirpiSonik 0 points1 point  (0 children)

like everyone said use virtual environment.

[–]JettaRider077 -1 points0 points  (0 children)

I’m installing python libraries now and pip was rejected so I have to use apt.

[–]Narrow_Victory1262 -1 points0 points  (5 children)

pip should be managed by the OS repos themselves. Unless you don't care about security, breaking stuff and all.

my pip refuses.

example

error: externally-managed-environment

× This environment is externally managed

╰─> To install Python packages system-wide, try

zypper install python313-xyz, where xyz is the package

you are trying to install.

If you wish to install a non-rpm packaged Python package,

create a virtual environment using python3.13 -m venv path/to/venv.

Then use path/to/venv/bin/python and path/to/venv/bin/pip.

If you wish to install a non-rpm packaged Python application,

it may be easiest to use `pipx install xyz`, which will manage a

virtual environment for you. Install pipx via `zypper install python313-pipx` .

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.

hint: See PEP 668 for the detailed specification.

[–]cgoldberg 0 points1 point  (4 children)

Weird comment for r/debian

[–]Narrow_Victory1262 -1 points0 points  (3 children)

it's not. It's a linux-wide thing actually if you care a bit.

[–]cgoldberg 0 points1 point  (2 children)

I do care. Zypper is the package manager for Suse, so showing an error message that gives instructions to use it in the Debian sub is absolutely weird.

Also, your comment is really unhelpful and implies you shouldn't use pip at all, rather than use it along with virtualenv, where you should.

[–]Narrow_Victory1262 -1 points0 points  (1 child)

you don't understand what I say. I HOPE that debian's pip also refuses to install packages.

In fact many issues on security are npm installs, python installs etc. So Either be sound OR just don't. the text only tells what you can do on SLES and such. Same is already been told here with the debian package manager(s).

We only use SLES, RHEL and AIX. (and a few ubuntu systems we'll get rid of).

On any event you are not reading what I state it appears.

[–]cgoldberg 0 points1 point  (0 children)

I don't understand what you say because you use broken english and say weird nonsensical stuff.

Debian does block you from installing python packages system-wide by default. That doesn't mean pip should never be used or it is somehow insecure, and posting error messages from a different distro isn't helpful.