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?
jupyter-notebook --help
includes the following:
--no-browser
Don't open the notebook in a browser after startup.
jupyter notebook --generate-config
然后编辑〜/ .jupyter / jupyter_notebook_config.py并添加
NotebookApp.open_browser = False
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.