How to Change the Default Browser Used by the Ipython/Jupyter Notebook in Linux

How to change the default browser used by jupyter notebook in windows

Thanks to @Darthbith and this post How to change the default browser used by the ipython/jupyter notebook in Linux? I was able to figure it out:

Step 1: To open Anaconda Prompt from the Start Menu and type

# for old notebook and JupyterLab < 3.0, or
jupyter notebook --generate-config
# for new nbclassic and JupyterLab >= 3.0
jupyter server --generate-config

This will generate the file ~/.jupyter/jupyter_notebook_config.py (or jupyter_server_config.py for nbclassic/new JupyterLab)

Step 2: Edit this file and change the following line (chrome is also is also in a local installation)

# for old notebook and JupyterLab < 3.0
c.NotebookApp.browser = u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'
# OR for new nbclassic and JupyterLab >= 3.0
c.ServerApp.browser = u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'

How to change the default browser used by the ipython/jupyter notebook in 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 #

How to change the default browser used by jupyter notebook in windows

Thanks to @Darthbith and this post How to change the default browser used by the ipython/jupyter notebook in Linux? I was able to figure it out:

Step 1: To open Anaconda Prompt from the Start Menu and type

# for old notebook and JupyterLab < 3.0, or
jupyter notebook --generate-config
# for new nbclassic and JupyterLab >= 3.0
jupyter server --generate-config

This will generate the file ~/.jupyter/jupyter_notebook_config.py (or jupyter_server_config.py for nbclassic/new JupyterLab)

Step 2: Edit this file and change the following line (chrome is also is also in a local installation)

# for old notebook and JupyterLab < 3.0
c.NotebookApp.browser = u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'
# OR for new nbclassic and JupyterLab >= 3.0
c.ServerApp.browser = u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'

Launch IPython notebook with selected browser

I had the same problem on windows and got it work this way:

  • Create a config file with command
    ipython profile create default

  • Edit ipython_notebook_config.py file, search for line

#c.NotebookApp.browser =''

and replace it with

import webbrowser
webbrowser.register('firefox', None, webbrowser.GenericBrowser('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe'))
c.NotebookApp.browser = 'firefox'

then it works for me.

Hope it will help you.

JPG



Related Topics



Leave a reply



Submit