Ask Your Question

Package management after PEP 668

asked 2023-12-20 08:11:51 +0200

filip gravatar image

I installed sagemath from my distro package manager meaning that sagemath will use the default system python installation. How I should install a library that I want to use in sage after PEP 668 ? The only option I see is to force it with '--break-system-packages', but I want to avoid that, is there any another option? I can use a virtual environment ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2023-12-20 19:55:35 +0200

Sage uses a virtual environment. If you install with pip, for example, then I think you should do sage --pip install ... and it will get installed into Sage's venv. Or use sage --python <other commands here> if you would install the package in some other way.

edit flag offensive delete link more


~ sage --pip install py_ecc
error: externally-managed-environment
× This environment is externally managed

It doesn't work,

filip gravatar imagefilip ( 2023-12-21 08:32:31 +0200 )edit

Maybe sudo sage --pip install ...?

John Palmieri gravatar imageJohn Palmieri ( 2023-12-21 18:40:51 +0200 )edit

You can also ask the package management people: once distros take over, they may make changes in the structure of the packaging, venvs, etc.

John Palmieri gravatar imageJohn Palmieri ( 2023-12-21 18:41:50 +0200 )edit

Are you on Debian ? This distro configures Python in a way forbidding the installation via pip. Which IS a royal pain in thé @$$... When refusing to install a packagé, this distro suggests a workaround I can't remember now. ISTR that sage -pip install <whatever>does work.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2023-12-21 19:26:50 +0200 )edit

Yes, I am on Debian. And yes, I have a workaround, sage --pip install <whatever> --break-system-packages but is not recommended. I don't think it's a Debian specific thing, all distros will be behave the same in the future.

filip gravatar imagefilip ( 2023-12-21 21:37:21 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2023-12-20 08:10:34 +0200

Seen: 192 times

Last updated: Dec 20 '23