[Rx] Jupyter Notebook–-Select Browser

2015-10-28_091835Jupyter Notebook is an interactive computational environment to run code, add rich text, compute mathematics, draw plots, and add rich media–all in the comfort of your browser.

I have a variation of Firefox, Palemoon, running as my default browser. When I run Jupyter Notebook, I wanted it to open in the Chrome browser.

It looked like a simple command line switch would do the job:

Jupyter Notebook -–browser=”chrome”

That doesn’t work. I tried it without quotes and single quotes. I’ve got a bald spot on the side of my head trying to figure this one out. There’s not much on the web.

Here’s how to do it:

Instructions

1. Create Config. In the Command Prompt Window, create a configuration file.

jupyter notebook --generate-config

2015-10-28_084934

This will create a file:

C:\Users\DevelopRx\.jupyter\jupyter_notebook_config.py 

The newly minted config file is located in your user directory. In my case, it is:

C:\Users\DevelopRx

If you’re lost and not sure where the config file is, there are some options. I cheated and used the desktop search engine Everything to find jupyter_notebook_config.py There are a few versions of the file. The one you want is in your Users directory.

Another alternative is to ask Jupyter where the heck it put your config file using the scary terminal window. On the command line, enter:

jupyter --config-dir 

This will spit out something like:

C:\Users\DevelopRx\.jupyter

2. Edit Config. Edit jupyter_notebook_config.py and search for:

# c.NotebookApp.browser = ''

Under that add the following lines:

import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'))
c.NotebookApp.browser = 'chrome'

2015-10-28_085721

Now, when you start up Jupyter Notebook from the command line it will open with Chrome.  End_Sign.12