Hello,
I previously installed SageMath 10.8 successfully on WSL Ubuntu 24.04 (Windows 11). However, after reinstalling WSL Ubuntu 24.04 recently, the installation now fails with:
error: externally-managed-environment
This is surprising because the exact same installation procedure worked before. After investigation, here is what actually happened.
1. Important clarification: my previous Ubuntu 24.04 was NOT the same as the current one
My earlier successful installation was done on a WSL Ubuntu 24.04.0 image that was not fully updated.
That older WSL image: - still used Python 3.11 - did not enforce PEP 668 - allowed pip to install system packages - was therefore compatible with SageMath 10.8
This explains why SageMath 10.8 installed correctly at that time.
2. Current Ubuntu 24.04 uses Python 3.12 and enforces PEP 668
After reinstalling WSL Ubuntu 24.04 recently, I now get a fully updated Ubuntu 24.04.1/24.04.2 image.
This updated version includes: - Python 3.12 (default system Python) - PEP 668 ("externally managed environment") - pip restrictions that block system-wide installations - updated Debian/Ubuntu packaging policies
As a result, during the final stage of the SageMath 10.8 installation, when Sage internally calls pip, the installation fails with:
error: externally-managed-environment
This behavior is new and did not exist in my previous WSL environment.
3. Python 3.12 is not supported by SageMath 10.8 or 10.9
In addition to PEP 668: - SageMath 10.8 and 10.9 are designed for Python 3.10 or 3.11 - Python 3.12 removes modules that SageMath still depends on - cysignals does not build on Python 3.12 - numpy 2.2.x has a known bug (missing f2py) that breaks Meson
Therefore, even without PEP 668, Python 3.12 is currently incompatible with SageMath.
4. Summary of the situation
- My old WSL Ubuntu 24.04 used Python 3.11, so SageMath 10.8 installed correctly.
- My new WSL Ubuntu 24.04 uses Python 3.12 + PEP 668, so SageMath 10.8 cannot install.
- This explains why the same installation procedure worked before but fails now.
- The change is due to recent ecosystem updates, not SageMath itself.
5. Questions for the Sage developers
- Is there a plan for SageMath to support Python 3.12?
- Is there an official workaround for PEP 668 on Ubuntu 24.04?
- Should users currently prefer Ubuntu 22.04 (Python 3.10) for building SageMath from source?
- Is Python 3.11 still the recommended version for SageMath 10.8/10.9?
Thank you for your help.