Installing SageMath 10.4 in Ubuntu 22.04 or 24.04
There is no Ubuntu system package for SageMath in Ubuntu 24.04; there is one for Ubuntu 22.04 but it provides only SageMath 9.5, which is quite old by now. Fortunately, building SageMath 10.4 from source in Ubuntu 22.04 or 24.04 is very easy.
First, install the dependencies, i.e. the Ubuntu packages required to build SageMath: simply open a terminal and type the single (long) line
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
A Jupyter page should then open in your browser. Click on "New" and select "SageMath 10.4" to open a Jupyter notebook with a SageMath kernel.
To use JupyterLab, simply run
sage -n jupyterlab
Installing SageMath 10.5.beta* in Ubuntu 22.04 or 24.04
To install the latest development version (beta series), follow the same instructions as above for SageMath 10.4, except for thegit clone
line
to be replaced by
git clone --branch develop https://github.com/sagemath/sage.git