How to fix a bug that jupyter notebook does not start automatically

I couldn't find a page that explains the target method of the jupyter automatic startup bug for beginners, so I summarized it.

As usual in the terminal trying to launch jupyter

jupyter notebook

If you enter

Unable to recognize the "open location" message.(-1708)

The phenomenon that the error message is displayed for a while. You can deal with it by directly hitting the displayed URL, but other measures at the moment are summarized.

(Hereafter when using Chrome)

1. How to add code to ".bash / profile"

First, check the file (this step is not necessary, but just in case)

cd

And move to your home directory at the terminal

ls -al

If you check the files in your home directory including special files in

 .bash_profile

There should be! So I'm going to add some code to this file.

Open the file with a suitable text editor and it's OK. Open Finder, in the folder of your home directory, Show hidden files using "command + shift +." Open ".bash_profile" using a text editor or the like.

スクリーンショット 2017-06-09 08.15.49.png

This time, I opened it with Atom.

スクリーンショット 2017-06-09 08.16.53.png

At the end of this file

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

To add.

スクリーンショット 2017-06-09 08.17.16.png

And save. You will be prompted for the administrator's name and password.

スクリーンショット 2017-06-09 08.17.31.png

Save it, restart your terminal and launch Jupyter and the bug should be fixed: blush:

If you are using zsh instead of bash, you can rewrite ".zshrc" in the same way.

2. How to add code to "~ / .jupyter / jupyter_notebook_config.py" [Additional notes]

Then, just in case another method. At the terminal

cd

Finally, move to your home directory.

cd ./.jupyter

Go to the folder ".jupyter" with

ls -al

Check the files in the folder with. If you have "jupyter_notebook_config.py", it's OK. If not, I will make it.

How to make it in the terminal

jupyter notebook --generate-config

Just hit.

Now that you have "jupyter_notebook_config.py", edit it!

Open Finder and display hidden files with "command + shift +.". Since there is "jupyter_notebook_config.py" in the folder ".jupyter", open it with a text editor etc. in the same way as method 1.

スクリーンショット 2017-06-09 09.41.53.jpg

Just add the following line to this file and you're good to go!

c.NotebookApp.browser = u'chrome'
スクリーンショット 2017-06-09 17.22.56.png

It's like this. Save it, restart your terminal and launch Jupyter and the bug should be fixed: blush:

[Addition] If this doesn't help, try the following line instead (I didn't start up automatically again, and I was back in the following line)

c.NotebookApp.browser = u'open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %s'

By the way, if you want to specify it in safari,

c.NotebookApp.browser = u'Safari'

It will be.

There was also a post saying that an error message was displayed when "Google Chrome" was used instead of "chrome". Also, in the case of safari, there was a post saying that "u'Safari" was useless and that it was fixed with "'Safari'". https://github.com/jupyter/notebook/issues/2438#issuecomment-301736816

Reference site: https://github.com/jupyter/notebook/issues/2438#issuecomment-301736816

Recommended Posts

How to fix a bug that jupyter notebook does not start automatically
How to batch start a python program created with Jupyter notebook
What to do if Jupyter Notebook on WSL does not start automatically in your browser
How to hide warnings that do not affect execution in Jupyter Notebook
How to automatically start a GCP preemptible VM
jupyter notebook does not start on mac fish
How to use Jupyter Notebook
How to use a tp-link wireless LAN slave unit that does not support Linux
Browser does not open automatically when jupyter notebook is started
How to import NoteBook as a module in Jupyter (IPython)
A special Python codec that seems to know but does not know
How to solve the problem that APL does not start after transferring to the actual device on Kivy-iOS
Jupyter Notebook does not show matplotlib graphs
How to execute commands in jupyter notebook
How to use jupyter notebook with ABCI
Jupyter Notebook Basics of how to use
How to use Jupyter notebook [Super Basic]
How to set up a jupyter notebook on ssh destination (AWS EC2)
How to debug with Jupyter or iPython Notebook
A story that sometimes does not work if pip is up to date
A memorandum of how to execute the! Sudo magic command in Jupyter Notebook
I tried to make a dictionary function that does not distinguish between cases
What to do when the graph does not appear in jupyter (ipython) notebook
What to do if NotADirectoryError: [Errno 20] Not a directory:'xdg-settings' appears in jupyter notebook
[systemd] How to deal with the problem that fancontrol does not work after suspending
How to use a library that is not originally included in Google App Engine
How to quickly create a machine learning environment using Jupyter Notebook with UbuntuServer 16.04 LTS
How to deal with Django's Template Does Not Exist
How to hold a hands-on seminar using Jupyter using docker
How to instantly launch Jupyter Notebook from the terminal
[Python] How to write a docstring that conforms to PEP8
I want to send a business start email automatically
How to view progress bar on Jupyter Notebook to see progress
How to deal with the phenomenon that Python (Jupyter notebook) executed on WSL becomes Aborted
How to quickly create a machine learning environment using Jupyter Notebook with UbuntuServer 16.04 LTS with anaconda
How to create a new file when the specified file does not exist — write if the file exists
Create a defaultdict that returns a defaultdict to create a world where KeyErrror does not occur (+ JSON parsing example)
SQL statement specifications that SQLite does not support and how to handle ALTER TABLE operations
I want to start a jupyter environment with one command
Day 65 (Solution) Jupyter notebook does not work with Kernel Not Conected.
How to write a test for processing that uses BigQuery
I want to use a virtual environment with jupyter notebook!
How to see the contents of the Jupyter notebook ipynb file
The usual way to add a Kernel with Jupyter Notebook
How to write a metaclass that supports both python2 and python3
A very convenient way to give a presentation on Jupyter Notebook
Ubuntu 20.04 does not start when trying to install nvidia driver
Automatically opens in a new window when launching Jupyter Notebook
I implemented a method to calculate the evaluation index (specificity, NPV) that scikit-learn does not have
How to quickly create a machine learning environment using Jupyter Notebook on macOS Sierra with anaconda
[IPython] How to Share IPython Notebook
How to change Jupyter layout
How to use IPython Notebook
How to hack a terminal
How to start the program
A simple way to launch Jupyter Notebook / Lab and set a password
When incrementing the value of a key that does not exist
How to resolve ModuleNotFoundError: No module named XXX in Jupyter Notebook
I wanted to create a smart presentation with Jupyter Notebook + nbpresent
How to use jupyter notebook without polluting your environment with Docker
If you try to start the jupyter notebook installed with pip and it says "command not found", it seems that you can go through the PATH.