pythonsshjupyter-notebookjupyterpython-webbrowser

Force Jupyter Notebook *not* to open a web browser


I'm running Jupyter notebooks (Python 3) on a remote cluster that I'm connected/tunneled to over SSH.

Jupyter's default behavior is to try to open the dashboard in a web browser when it launches -- aparently (I only just updated), at some point they switched to the Python 3 webbrowser library for this.

According to webbrowser's documentation:

text-mode browsers will be used if graphical browsers are not available or an X11 display isn’t available.

This is exactly what happens. I run jupyter notebook, webbrowser launches elinks, and my one-time authentication token gets eaten, preventing me from connecting to the notebook.

Jupyter isn't configured to use a browser -- c.NotebookApp.browser is commented out in my config -- and running BROWSER="" jupyter notebook doesn't help either.

How can I force Jupyter not to open any browser?


Solution

  • jupyter notebook --generate-config
    

    Then edit ~/.jupyter/jupyter_notebook_config.py and Add

    NotebookApp.open_browser = False