I tried the accepted answer in Ubuntu 22.04 answer, but it didn't work for me which I discovered was because Firefox is packaged as a snap package in Ubuntu 22.04. I circumvented this obstacle by installing Web (Web browser for GNOME) with this command:
sudo apt install epiphany
Create jupyter_notebook_config.py
by:
jupyter notebook --generate-config # type y for yes at the prompt
Then open ~/.jupyter/jupyter_notebook_config.py
for editing in a text editor and change:
# c.NotebookApp.browser = ''
to:
c.NotebookApp.browser = '/usr/bin/epiphany'
Don't forget to delete the # so it's not a comment anymore. Inspiration for these last 2-3 steps goes to https://stackoverflow.com/a/35578527/. You can use a different web browser if you don't like Web as long as it's not a snap package and you change the path from /usr/bin/epiphany
to the path to your web browser which you can find by running a command of the form which my-web-browser
.
It still won't work though, so you have to do one more step. It's the same as in the accepted answer to this question. Change the ownership of the ~/.local/share/jupyter
directory from root to user. Instead of user in the below command replace it with your own username that you login with.
sudo chown -R user:user ~/.local/share/jupyter