Sage notebook only runs when a browser is already open

asked 2020-02-05 12:55:43 -0600

anonymous user


I just installed sage 8.8 (it's not the newest sage, but it works for the most part) on my Linux machine and I had everything working at some point but the other day it isn't working as I'd expect it to be. When I do

$ sage -n jupyter --browser=firefox

in the terminal without Firefox opened, I get

│ SageMath version 8.8, Release Date: 2019-06-26                     │
│ Using Python 2.7.15. Type "help()" for help.                       │
Please wait while the Sage Jupyter Notebook server starts...
[I 09:42:16.791 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js
[I 09:42:17.016 NotebookApp] The port 8888 is already in use, trying another port.
[I 09:42:17.016 NotebookApp] The port 8889 is already in use, trying another port.
[I 09:42:17.017 NotebookApp] The port 8890 is already in use, trying another port.
[I 09:42:17.017 NotebookApp] The port 8891 is already in use, trying another port.
[I 09:42:17.017 NotebookApp] The port 8892 is already in use, trying another port.
[I 09:42:17.023 NotebookApp] Serving notebooks from local directory: /home/user
[I 09:42:17.023 NotebookApp] The Jupyter Notebook is running at:
[I 09:42:17.024 NotebookApp] <local host>
[I 09:42:17.024 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:42:17.027 NotebookApp] 

    To access the notebook, open this file in a browser:
        <server file>
    Or copy and paste one of these URLs:

(I don't have enough karma to actually post the links but "local host" is the link to the notebook and "server file" is the HTML file in "/var/run/user/.../nbserver-...-open.html") which seems fine but Firefox doesn't appear to be open. When I try to open another Firefox browser, I get a message saying that there is already another browser opened when there isn't and I would have to kill the Firefox processes in order to open it again. Interestingly, when I try the same command again with a browser already opened, a new tab with the sage notebook appears.

I get the feeling that the problem could be coming from my init.sage file but I'm not sure if that would be the case.

from sage.misc.viewer import viewer
viewer.browser('open -a /usr/bin/firefox')

My environment variable SAGE_BROWSER is set to firefox:


If there's anything else that you'd like me to provide, let me know.

edit retag flag offensive close merge delete


Did you try to remove your init.sage? That will help you understand whether the problem comes from here.

vdelecroix gravatar imagevdelecroix ( 2020-02-06 10:52:40 -0600 )edit

With the notebook, it is also useful to restart the browser once in a while if an update was made (I rarely restart my browser and I was getting similar problems with start-up, restarting the browser did the thing...)

Maybe try with have a freshly updated firefox, that does not run, and moving the .sage folder to another location and then so what happens?

jipilab gravatar imagejipilab ( 2020-02-07 11:44:42 -0600 )edit