Skip to content

SageMath 9.6 compilation notes

F Lengyel edited this page Sep 19, 2022 · 2 revisions

These are skeletal notes for compiling SageMath 9.6 under Ubuntu Linux 20.04. My installation of Ubuntu Linux runs under WSL2, which has its own configuration. I use MobaXTerm to launch Ubuntu, but I digress.

  1. Create a directory $HOME/sage.
  2. Untar the source into $HOME/sage.
  3. Create the following file $HOME/sagenv.sh to set environment variables and create configure scripts.
# Source these variables
export PATH=$HOME/sage/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
export SAGE_HOME=$HOME/sage/sage-9.6
export SAGE_LOCAL=$HOME/sage/local
export MAKE="make -j4"

./configure --prefix=$SAGE_LOCAL --with-system-givaro=no --enable-d3js \
            --enable-gap3 --enable-gap_jupyter --enable-gap_jupyter \
            --enable-gap_jupyter --enable-gap_jupyter --enable-pari_galpol \
            --enable-pari_jupyter --enable-pysingular --enable-python_igraph \
            --enable-r_jupyter --enable-singular_jupyter --enable-lidia \
            --enable-p_group_cohomology --enable-coxeter3 --enable-lie

More complete notes

  1. Create a directory $HOME/sage.

DOWNLOAD sage-9.6.tar.gz VIA

wget https://mirrors.mit.edu/sage/src/sage-9.6.tar.gz
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install bc binutils bzip2 ca-certificates cliquer
cmake curl ecl eclib-tools fflas-ffpack flintqs g++ gcc gengetopt
gfan gfortran glpk-utils gmp-ecm lcalc libatomic-ops-dev
libboost-dev libbraiding-dev libbrial-dev libbrial-groebner-dev
libbz2-dev libcdd-dev libcdd-tools libcliquer-dev
libcurl4-openssl-dev libec-dev libecm-dev libffi-dev
libflint-arb-dev libflint-dev libfplll-dev libfreetype6-dev
libgc-dev libgd-dev libgf2x-dev libgiac-dev libgivaro-dev
libglpk-dev libgmp-dev libgsl-dev libhomfly-dev libiml-dev
liblfunction-dev liblinbox-dev liblrcalc-dev liblzma-dev
libm4ri-dev libm4rie-dev libmpc-dev libmpfi-dev libmpfr-dev
libncurses5-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
libz-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
python3-distutils r-base-dev r-cran-lattice singular singular-doc
sqlite3 sympow tachyon tar tox xcas xz-utils

sudo apt-get install 4ti2 clang coinor-cbc coinor-libcbc-dev
graphviz libfile-slurp-perl libgraphviz-dev libigraph-dev
libisl-dev libjson-perl libmongodb-perl libnauty-dev libperl-dev
libpolymake-dev libsvg-perl libterm-readkey-perl
libterm-readline-gnu-perl libxml-libxslt-perl libxml-writer-perl
libxml2-dev lrslib ninja-build pari-gp2c pdf2svg polymake texinfo
sudo apt-get install texlive texlive-extra-utils texlive-xetex
latexmk pandoc dvipng default-jdk
sudo apt-get install libncurses5 libncursesw5 ncurses-base
ncurses-bin bison libncurses5-dev

CREATE sagenv.sh file

# Source these variables
export PATH=${HOME}/sage/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
export SAGE_HOME=${HOME}/sage/sage-9.6
export SAGE_LOCAL=${HOME}/sage/local
#export SAGE_BUILD_DIR="$HOME/tmp/sage"
export MAKE="make -j8"

./configure --prefix=$SAGE_LOCAL --without-system-python3 --with-system-givaro=no --enable-d3js \
            --enable-gap3 --enable-gap_jupyter --enable-gap_jupyter \
            --enable-gap_jupyter --enable-gap_jupyter --enable-pari_galpol \
            --enable-pari_jupyter --enable-pysingular --enable-python_igraph \
            --enable-singular_jupyter --enable-lidia --enable-coxeter3 --enable-lie \
            --enable-r_jupyter --enable-p_group_cohomology  \
            --enable-pandoc_attributes --enable-pynormaliz --enable-rubiks  --enable-saclib \
            --enable-notedown --enable-4ti2 --enable-ccache --enable-jupymake --enable-kenzo \
            --enable-libsemigroups --enable-gap-packages --enable-qepcad \
            --enable-database_cremona_ellcurve --enable-database_jones_numfield \
            --enable-database_knotinfo --enable-database_kohel \
            --enable-database_mutation_class --enable-database_odlyzko_zeta \
            --enable-database_stein_watkins  --enable-database_stein_watkins_mini \
            --enable-database_symbolic_data --enable-debugpy --enable-deformation \
            --enable-fricas --enable-glucose --enable-latte_int --enable-mathics \
            --enable-mathics_scanner --enable-mcqd --enable-polylib --enable-polytopes_db_4d \
            --enable-pycosat  --enable-tdlib
cd $HOME/sage/sage-9.6
source ../sagenv.sh
make

When this completes, environment variables to the end of $HOME/.bashrc as follows

# set JAVA_HOME
export JAVA_HOME=$(readlink -e /etc/alternatives/java)
JAVA_HOME=${JAVA_HOME/\/bin\/java/}
export TERM=xterm-256color  # this is optional
SAGEBIN=$HOME/sage/local/bin
SAGE_LOCAL=$HOME/sage/local
SAGE_ROOT=$HOME/sage
if [ "$(echo $PATH | awk -F ':' '{print $1}')" != "${SAGEBIN}" ]; then
   export PATH=$HOME/sage/local/bin:$PATH
fi

restart to pick up the environment variables

shutdown -r now

login again

sage -i jupyterlab_widgets 
jupyter nbextension install --py widgetsnbextension --sys-prefix 
jupyter nbextension enable widgetsnbextension --py --sys-prefix