How to change the default browser used by the ipython/jupyter notebook in Linux?

LinuxGoogle ChromeFirefoxIpythonJupyter

Linux Problem Overview


I'm on Linux Mint 17.3.

How do I change the default browser used by the Jupyter notebook?

I have installed the notebook as a part of Anaconda 3 and it opens up in my default browser—Chrome. But for some reason, Chrome won't let me make a new ipynb. Clicking the 'new' button simply doesn't do anything. So I copied the notebook url to Firefox and it works perfectly fine there.

Is there a way I can make it work with Chrome? Otherwise, how do I change the default browser? The usual answer I've come across is that I have to change the c.NotebookApp.browser option, but I can't find a way to do so, since trying to find ipython_notebook_config in the terminal comes up with 4 results:

./anaconda3/lib/python3.5/site-packages/jupyter_core/tests/dotipython/profile_default/ipython_notebook_config.py
./anaconda3/lib/python3.5/site-packages/jupyter_core/tests/dotipython_empty/profile_default/ipython_notebook_config.py
./anaconda3/pkgs/jupyter_core-4.0.6-py35_0/lib/python3.5/site-packages/jupyter_core/tests/dotipython/profile_default/ipython_notebook_config.py
./anaconda3/pkgs/jupyter_core-4.0.6-py35_0/lib/python3.5/site-packages/jupyter_core/tests/dotipython_empty/profile_default/ipython_notebook_config.py

Linux Solutions


Solution 1 - Linux

You can create jupyter_notebook_config.py by:

jupyter notebook --generate-config

Then you go to

~/.jupyter/jupyter_notebook_config.py

and change

# c.NotebookApp.browser = ''

to for example:

c.NotebookApp.browser = '/usr/bin/google-chrome %s'

You can choose which ever browser is installed. You'll find the path for example by typing which firefox Do not forget to delete the #

Solution 2 - Linux

The accepted answer is great, here is a solution if you want to change it one time:

jupyter-notebook --browser=firefox

Of course you could make a bash wrapper script with this command or create a .desktop file that would let you launch it in your preferred browser every time you use that launcher.

An example wrapper script could look like this:

#!/bin/bash
jupyter-notebook --browser=firefox

You could then place it in your PATH, e.g. $HOME/bin/jnbff.sh, so you can easily launch it from any directory by simply typing its name.

Sidenote: the dash in jupyter-notebook allows for tab-completion, the usually recommended way with space (i.e. jupyter notebook) doesn't.

Solution 3 - Linux

Update for notebooks running in the JupyterLab interface

As JupyterLab is increasingly replacing Jupyter Notebook, here is an update to customize the default browser in which JupyterLab is launched. The solution is extremely similar to the accepted answer from @Christof:

jupyter-lab --generate-config

will create ~/.jupyter/jupyter_lab_config.py in which the line:

# c.ServerApp.browser = ''

can be uncommented and edited with the default browser of choice. For instance:

c.ServerApp.browser = '/usr/bin/qutebrowser %s'

Solution 4 - Linux

The following worked for me on win10. For firefox: c.NotebookApp.browser = u'c:/Program Files/Mozilla Firefox/firefox.exe %s'

For chrome c.NotebookApp.browser = u'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'

note the 1) "" vs "/" 2) the u and %s

Solution 5 - Linux

Chrome Browser > Settings (Scroll all the way to the bottom) > Change Default browser to Chrome > New window would pop up. Change the default browser there!

Worked for me! (Windows 10 User)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKevinView Question on Stackoverflow
Solution 1 - LinuxChristofView Answer on Stackoverflow
Solution 2 - LinuxjenaView Answer on Stackoverflow
Solution 3 - LinuxprosoitosView Answer on Stackoverflow
Solution 4 - Linuxpy_newbieView Answer on Stackoverflow
Solution 5 - LinuxSurbhiView Answer on Stackoverflow