Reputation: 35793
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?
Upvotes: 30
Views: 25392
Reputation: 75740
If you use jupyter lab
or other jupyter tooling, the browser might still open.
To always disable the browser for all jupyter commands, edit your default config at:
~/.jupyter/jupyter_notebook_config.py
And add the following lines:
c.NotebookApp.open_browser = False
c.LabApp.open_browser = False
c.ServerApp.open_browser = False
c.ExtensionApp.open_browser = False
Source:
From Jupyter help pages:
--no-browser Prevent the opening of the default url in the browser. Equivalent to: [--ServerApp.open_browser=False --ExtensionApp.open_browser=False]
Upvotes: 1
Reputation: 827
jupyter notebook --generate-config
Then edit ~/.jupyter/jupyter_notebook_config.py
and Add
NotebookApp.open_browser = False
Upvotes: 19
Reputation: 180
You can achieve this by specifying --no-browser:
$ jupyter notebook --no-browser
I also recommend that you specify the port you want to use:
jupyter notebook --no-browser --port= <port_number>
ie:
$ jupyter notebook --no-browser --port=8888
You have to keep in mind that when you do this, jupyter will provide you with a token on the console, token that the server will ask you when connect remotely through the browser.
If you want to simplify this procedure, you can set a password that is easier for you to remember. To do this, you can run in a console:
$ jupyter notebook --generate-config
and later:
$ jupyter notebook password
This last command will ask you for the password that you wish to use to enter remotely.
Regards!
Upvotes: 8
Reputation: 280500
jupyter-notebook --help
includes the following:
--no-browser
Don't open the notebook in a browser after startup.
Upvotes: 37