Dear Maintainer,
On sid/bookworm, package sagemath 9.5-6 does not admit package installs. For instance all of
sage -pip install snappy
sage -pip install --user snappy
sudo sage -pip install snappy
sudo sage -pip install --user snappy
sage-python -m pip install --user asttokens
sudo sage-python -m pip install --user asttokens
, and variations to install various 3rd-party packages into Sagemath produce the same output
(quote begins)
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
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.
(quote ends)
While I can understand the need to control packages in system Python, core system maintenance does not depend on a stable Sagemath environment. It appears that the Debian packaged Sagemath uses system Python (which is an unusual choice since "New in Sage 9.5 is experimental support for system Python 3.10.x." (from https://wiki.sagemath.org/ReleaseTours/sage-9.5 ), not 3.11.x).
Even so, the "--user" install attempts above should attempt to put Sagemath SPKGs in the user's site instead of the global site. Of course, this conflicts with the Python SnapPy package (which is not interchangeable with the Sagemath SnapPy package).
In any event, it appears that 3rd party packages cannot be installed to Sagemath (or perhaps 3rd party packages which are different from their vanilla Python packages), which is a significant functionality loss. The produced diagnostic is misleading since this is the diagnostic from system python/pip, not the Sagemath-built python/pip (which occurs during typical build from source) nor is this diagnostic actionable for Sagemath packages.