Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing browser for IPython Notebook from system default

I would like to keep firefox as my system default browser on my Mac, but launch IPython Notebook in Chrome[1].

This answer led me to my ipython_notebook_config.py file but I can't get an instance of Chrome running. After c = get_config() and import webbrowser, I've tried:

  1. webbrowser.register(u'chrome', None, webbrowser.Chrome())

  2. webbrowser.register(u'chrome', webbrowser.Chrome)

  3. webbrowser.register(u'chrome', None, webbrowser.GenericBrowser('/Applications/Browsers/Chrome.app'))

  4. webbrowser.register(u'chrome', None, webbrowser.GenericBrowser('/Applications/Browsers/Chrome.app/Contents/MacOS/Google\ Chrome'))

All followed by c.NotebookApp.browser = u'chrome'

I've fiddled with webbbrowser in the interpreter, and couldn't figure out how to create an instance of Chrome.


[1]: PS Why is IPython Notebook so slow in firefox, especially for pylab with the inline backend? It's orders of magnitude faster (for rendering, scrolling, etc) in chrome.

like image 432
askewchan Avatar asked May 23 '13 02:05

askewchan


1 Answers

Since the great switch to Jupyter, and with recent versions of OS X (e.g., Yosemite), Jupyter/iPython (e.g., 4.0.1), and Chrome (e.g., 47), things have changed a bit. Jupyter/iPython no longer puts the notebook config file in ~/.ipython; it's now in ~/.jupyter, and the default file is generated with

jupyter notebook --generate-config

If you have an existing ipython_notebook_config.py you can migrate it with jupyter migrate (H/T).

After generating or migrating your config file, add the following line to jupyter_notebook_config.py:

c.NotebookApp.browser = u'/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %s'
like image 200
Dan Avatar answered Sep 19 '22 14:09

Dan