[PYTHON] Browser does not open automatically when jupyter notebook is started

When I tried to open jupyter nootbook, the following error was displayed and the browser did not open automatically, so I investigated how to deal with it. Probably due to a Mac OS update.

0:97: execution error: "http://localhost:8888/tree?token=2ab101b71b3d00b692865cb0039257b68afa12c9d57615fd"Cannot recognize the “open location” message.(-1708)

Or

0:97: execution error: "http://localhost:8888/tree?token=2ab101b71b3d00b692865cb0039257b68afa12c9d57615fd" doesn’t understand the “open location” message. (-1708)

environment

solution

Browser-independent method

Solved by adding the following to .zshrc.

~/.zshrc


export BROWSER=open

If that doesn't help, try the following:

If your browser is Chrome

I solved it by adding the following to .zshrc.

~/.zshrc


export BROWSER=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

If it is not zsh, change the .zshrc part to .bash_profile etc. as appropriate.

When the browser is Safari, Firefox

The solution is to add the following to ~ / .jupyter / jupyter_notebook_config.py.

~/.jupyter/jupyter_notebook_config.py


c.NotebookApp.browser = u'Safari'

Or

~/.jupyter/jupyter_notebook_config.py


c.NotebookApp.browser = u'firefox'

Summary

Try the method of Safari and firefox with chrome. When I tried the chrome method in Safari or firefox, it didn't work. If possible, I would like to unify to either of the above. If there is something that you can do, please comment. Also, if you say that it does not have to be opened automatically, you do not need to do something like ↑. This time, we dealt with it as a first aid measure, but if it is officially dealt with, it will not be necessary to take measures by ourselves.

reference

https://github.com/jupyter/notebook/issues/2438

Recommended Posts

Browser does not open automatically when jupyter notebook is started
What to do if Jupyter Notebook on WSL does not start automatically in your browser
Jupyter Notebook does not show matplotlib graphs
jupyter notebook does not start on mac fish
What to do when the graph does not appear in jupyter (ipython) notebook
Get started Jupyter Notebook
Day 65 (Solution) Jupyter notebook does not work with Kernel Not Conected.
A note when I can't open Jupyter Notebook on Windows
Automatically opens in a new window when launching Jupyter Notebook
[Windows + anaconda] Automatically activate the environment when the command prompt is started
Jupyter does not show matplotlib graph
Error "Entry point not found" when starting Jupyter Notebook in virtual environment
python note: when easy_install is not available
When Anaconda Navigator (Mac) does not start
When cv2.VideCapture (aviname) does not read well
[EC2] What to do when selenium is stuck and processing does not proceed