Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I launch Jupyter Notebook in Safari?

I am on a Mac OS, and my default browser is Firefox.

In terminal, I ran jupyter notebook --generate-config. Then, in a text editor, I opened ~/.jupyter/jupyter_notebook_config.py

I changed c.NotebookApp.browser = u'' to c.NotebookApp.browser = u'/Applications/Safari.app/Contents/MacOS/Safari %s'

However, when I run jupyter notebook, I get the following output:

```
[I 15:14:23.717 NotebookApp] [nb_conda_kernels] enabled, 3 kernels found
[I 15:14:24.586 NotebookApp] [nb_anacondacloud] enabled
[I 15:14:24.589 NotebookApp] [nb_conda] enabled
[I 15:14:24.626 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 15:14:24.626 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named nbbrowserpdf.exporters.pdf
[I 15:14:24.632 NotebookApp] Serving notebooks from local directory: /Users/ironaut/Tutorials/DAND/Jupyter
[I 15:14:24.632 NotebookApp] 0 active kernels 
[I 15:14:24.632 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=74a348c3fdec07e929dde216c244e1a9164badc47f079819
[I 15:14:24.632 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Failed to acquire exclusive access to history store at file:///Users/ironaut/Library/Safari/History.db. Falling back to an in-memory history store.
[W 15:22:55.201 NotebookApp] 401 POST /login?next=%2Ftree%3F (::1) 1.30ms referer=http://localhost:8888/login?next=%2Ftree%3F
```

Without the changes to the config file, jupyter launches okay in Firefox.

like image 267
Oneironaut Avatar asked Jan 09 '17 20:01

Oneironaut


1 Answers

You almost had all steps. Re-iterating for the benefit of the readers.

Make sure that firefox is the default browser. Or any other browser for that matter.

I am using atom as text editor. Feel free to use any other.

Execute

$ jupyter notebook --generate-config
$ atom ~/.jupyter/jupyter_notebook_config.py

find and change

c.NotebookApp.browser = u''

to

c.NotebookApp.browser = u'/usr/bin/open -a Safari %s'

Test

$ jupyter notebook
like image 122
Drj Avatar answered Oct 09 '22 18:10

Drj