11

sagemath is not available in the official repositories in Noble (24.04). It was available until mantic (23.10).

Was it removed completely? Or is it going to be back? How to install sagemath in Ubuntu 24.04?

Unfortunately building from source is not an option since the gcc/g++ version 13 is so hopelessly unstable it is no longer able to build such a an enormous project without the infamous "internal compiler error" popping up constantly.

2 Answers2

7

Was it removed completely? Or is it going to be back?

It has been completely dropped from Ubuntu 24.04 and Debian Trixie due to a sagemath bug: It fails to build in python 3.12. The sagemath developers are working on it. But it will not come back to Ubuntu 24.04 as Ubuntu does not change the software in a particular release during its lifetime.

However, once the bug is fixed upstream, sagemath will most likely come back in a later version of Ubuntu.

How to install sagemath in Ubuntu 24.04?

The workaround is to use Mamba or Conda to install sagemath, as described here.

First, install miniforge with

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh

Then, create an environment for sage with mamba, and install sage in the environment, with python3.10:

mamba create -n sage sage python=3.10

Enter the sagemath environment with

conda activate sage

And run sagemath with

sage
7

The latest version of SageMath (10.4) can be built smoothly in Ubuntu 24.04 with the system gcc (13.2) and python (3.12.3). Here are the steps (adapted from this page):

First, install the Ubuntu packages required to build SageMath via the command

sudo apt install automake bc binutils bzip2 ca-certificates cliquer cmake curl ecl eclib-tools fflas-ffpack flintqs g++ gengetopt gfan gfortran git glpk-utils gmp-ecm lcalc libatomic-ops-dev libboost-dev libbraiding-dev libbz2-dev libcdd-dev libcdd-tools libcliquer-dev libcurl4-openssl-dev libec-dev libecm-dev libffi-dev libflint-dev libfreetype-dev libgc-dev libgd-dev libgf2x-dev libgiac-dev libgivaro-dev libglpk-dev libgmp-dev libgsl-dev libhomfly-dev libiml-dev liblfunction-dev liblrcalc-dev liblzma-dev libm4rie-dev libmpc-dev libmpfi-dev libmpfr-dev libncurses-dev libntl-dev libopenblas-dev libpari-dev libpcre3-dev libplanarity-dev libppl-dev libprimesieve-dev libpython3-dev libqhull-dev libreadline-dev librw-dev libsingular4-dev libsqlite3-dev libssl-dev libsuitesparse-dev libsymmetrica2-dev zlib1g-dev libzmq3-dev libzn-poly-dev m4 make nauty openssl palp pari-doc pari-elldata pari-galdata pari-galpol pari-gp2c pari-seadata patch perl pkg-config planarity ppl-dev python3-setuptools python3-venv r-base-dev r-cran-lattice singular sqlite3 sympow tachyon tar tox xcas xz-utils

To benefit from extra functionalities when running SageMath (e.g. exporting a Jupyter notebook to pdf), it is recommended to install some additional Ubuntu packages:

sudo apt install texlive-latex-extra texlive-xetex latexmk pandoc dvipng

Then you can download SageMath 10.4 sources and launch the build by typing (from you home directory or from the directory in which you want SageMath to be installed):

git clone --branch master https://github.com/sagemath/sage.git
cd sage
make configure
./configure
MAKE="make -j8" make

The last command launches the build in parallel on 8 threads (as specified by -j8); adapt to your CPU (usually you may choose a number of threads that is twice the number of cores of your CPU). The build time is about half an hour on a modern CPU. Once it is finished, you can create a symbolic link by typing:

sudo ln -sf $(pwd)/sage /usr/local/bin

Then you can change to any directory and start SageMath in Jupyter by running sage -n (or sage -n jupyterlab to run SageMath in Jupyterlab).