Ask Your Question

Sagemath stopped working after installing ubuntu 22.04

asked 2022-09-05 22:11:14 +0200

anonymous user


updated 2022-11-08 10:02:22 +0200

FrédéricC gravatar image

Since updating to ubuntu 22.04 (and installing the PPA version of Firefox), sagemath stops working: The sagemath9.5 kernel cannot be connected to jupyter. Removin and reinstalling has no effect what todo?

edit retag flag offensive close merge delete


This might be a duplicate of See also Can you run Sage from the command line, or does that fail, too?

John Palmieri gravatar imageJohn Palmieri ( 2022-10-28 20:35:10 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2023-01-28 13:36:28 +0200

ortollj gravatar image

updated 2023-01-28 13:49:00 +0200

here is how I solved this problem and icing on the cake it solved the problem of windows SageMath shortcuts which no longer allowed to launch firefox. with leaving Ubuntu22.04 and returning to Ubuntu20.04 !

# I must precise that before that I first uninstall ubuntu with settings --> apps ->installed apps -> ubuntu
# but it could be not neccessary

# in PowerShell cmd :
wsl --unregister ubuntu
wsl --list --online
wsl --install -d Ubuntu-20.04
sudo apt update
sudo apt upgrade

search Ubuntu in apps and launch it

#in ubuntu cmd

sudo apt update
sudo apt 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 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
# pb with ssh, this line does not work but it is not important! 
sudo apt-get install  autoconf automake git gpgconf libtool openssh openssh-client pkg-config
tar xvf sage-9.7.tar.gz
cd sage-9.7
make -j32 # 16 cores so -j32 twice the cores #

cd ~

#put theses 3 lines below in it (replace ortollj by your linux user name):

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

# make it executable
chmod ug+x

# Below is where your ubuntu2004.exe  is located, User is your Windows User name
#( for me ubuntu2004.exe but it could be ubuntu.exe , please check the location)

Create windows shortcut

This is a final nicety that lets you start the JupyterLab server in one click:

    Open Windows explorer, and type %APPDATA%\Microsoft\Windows\Start Menu\Programs
    Make a copy of any of the program icons – we’ll customise it to do what we want
    Right-click, and choose properties.
    On the General tab:
        Change the name to whatever you want.
    On the Shortcut tab:
        Change Target to: C:\Users\User\AppData\Local\Microsoft\WindowsApps\ubuntu2004.exe run ~/
        Change Start in to: %USERPROFILE%
        Change Run to: Minimised
        Change the icon if you want – there are plenty of pieces of software that can create a .ico icon file one from an image file.
    Now hit the start button or key and type the name you gave it. it should appear in the list, and should load the server and fire up your browser when you click on it.

image description

edit flag offensive delete link more


I forgot to tell that also in ~/.bashrc , I put

alias h=history
alias sage=~/sage-9.7/sage

But trying to suppress error :tcgetpgrp failed: Not a tty by putting these 3 lines below(choose your prefered Web Browser) in ~/.bashrc

# export BROWSER='/mnt/c/Program Files/Google/Chrome/Application/chrome.exe'
export BROWSER='/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
#export BROWSER='/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'

The kernel connection problem had come back ! so I comment all these 3 lines and then all is ok except this tiny error :tcgetpgrp failed: Not a tty

ortollj gravatar imageortollj ( 2023-01-28 17:05:23 +0200 )edit

I ask myself if the line:sudo apt-get install autoconf automake git gpgconf libtool openssh openssh-client pkg-config should be replaced by

sudo apt-get install  autoconf automake git gpgconf libtool openssh-server openssh-client pkg-config

to avoid the error message :E: Unable to locate package openssh

from install from source

ortollj gravatar imageortollj ( 2023-02-12 13:42:36 +0200 )edit

answered 2022-10-28 19:35:29 +0200

richardquint gravatar image

The problem may be because of a conflict with the new version of python installed by the upgrade. This may be overkill, but when it happened to me with sage-9.7, rebuilding sage solved the problem.

edit flag offensive delete link more


To build Sage 9.7 from source in Ubuntu 22.04, you may follow these steps:

eric_g gravatar imageeric_g ( 2022-10-29 14:39:24 +0200 )edit

W11 WSL UBUNTU 22.04 SageMath 9.7

Since yesterday I encounter a strange phenomenon with Jupyter notebook. Every time I want to open one of my saved SageMath .ipynb file I encounter a problem connecting to the kernel, However I can open a new virgin .ipynb file and write SageMath code in it and everything works. I have however found a very curious workaround to use my saved SageMath ipynb files. I launch sage in Ubuntu with no Jupyter notebook, only sage,
I leave it with exit, then I launch sage --notebook jupyter, and only after that, I can open one of my old ipynb files which then connects to the kernel !!

ortollj gravatar imageortollj ( 2023-01-24 09:38:37 +0200 )edit

No for me @richardquint the problem is not resolved after reinstalling SageMath. Very weird.

ortollj gravatar imageortollj ( 2023-01-26 13:03:17 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-09-05 22:11:14 +0200

Seen: 1,033 times

Last updated: Jan 28 '23