best and easy way to install SageMath in W11

asked 2023-01-31 07:24:07 +0200

ortollj gravatar image

updated 2023-02-14 18:18:37 +0200

Hi as I got kernel connection problem see pb SageMath kernel connection , I change my way to install SageMath, using Linux Firefox instead of W11 Firefox . and then no kernel pb connection yet !.

moreover my W11 SageMath shortcut is also working ! ;-)

follow these steps:

in PowerShell cmd run as administrator: install WSL2

wsl --install -d Ubuntu-22.04

restart the computer

launch Ubuntu apps an in the Ubuntu cmd shell :

    1  sudo apt update
    2  sudo apt upgrade

    4  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 ninja-build openssl palp pari-doc pari-elldata pari-galdata pari-galpol pari-gp2c pari-seadata patch perl pkg-config planarity ppl-dev python3 python3-distutils python3-venv r-base-dev r-cran-lattice singular singular-doc sqlite3 sympow tachyon tar tox xcas xz-utils

    6  wget
    7  tar xvf sage-9.7.tar.gz

    9  nano ~/.bashrc
#write this line in it

alias sage=~/sage-9.7/sage

   10  source  ~/.bashrc
   11  cd sage-9.7
   12  ./configure
   13  sudo apt-get update   
   15  sudo apt-get upgrade

   23  ./configure ./config.status --recheck && ./config.status
   24  cd sage-9.7/
   25  make -j32
   26  nano
#write these 3 lines below and adapt to your user name

cd '/mnt/c/Documents and Settings/user/Mes documents/IPYNBpc'
/home/ortollj/sage-9.7/sage --notebook jupyter

   27  chmod ug+x

   69  sudo apt install x11-apps

#test graphics app
   70  xeyes &
   71  xcalc

   72  sudo apt install octave
   73  octave --gui &
#quit all apps above 
   81  sudo snap install firefox
   83  sudo apt-get update   
   84  sudo apt-get upgrade
# test

   86  ./

I got errors in executing Julia script !, so test octave graphics simply with :

x = linspace(0,1,10)
y = x.^2


you can also use SageMath without using Jupyter notebook, the plots now work in Ubuntu WSL W11. plot with imageMagic

edit retag flag offensive close merge delete


attention!, I had forgotten an important step in my cmd summary to configure Ubuntu. but it is in 4. Configure Ubuntu from the link above

sudo nano /etc/wsl.conf

and put in it:


if one omit this detail we get the error !! :

error: cannot communicate with server: Post "http://localhost/v2/snaps/firefox": dial unix /run/snapd.socket: connect: no such file or directory

when after sudo apt install snapd

sudo snap install firefox
ortollj gravatar imageortollj ( 2023-02-14 07:27:10 +0200 )edit

see also Debian/Ubuntu package installation for complete pkg installation

ortollj gravatar imageortollj ( 2023-02-14 17:53:08 +0200 )edit