How to Change the Default Browser Used by Jupyter Notebook in Windows

As a software engineer you might have come across the popular Jupyter Notebook an opensource web application that allows you to create and share documents containing live code equations visualizations and narrative text While Jupyter Notebook is a powerful tool for data analysis visualization and programming you might prefer to use a different browser than the default one provided by the system

In this blog post, we’ll cover the steps to change the default browser used by Jupyter Notebook in Windows. This guide is geared towards data scientists and developers who use Jupyter Notebook for their data analysis and visualization projects.

Table of Contents

  1. Why Change the Default Browser?
  2. Step by Step Guide to Change the Default Browser
  3. Conclusion

Why Change the Default Browser?

Jupyter Notebook typically opens in your default system browser, which, on a Windows machine, is usually Microsoft Edge or Internet Explorer. However, you might want to use a different browser for several reasons:

  • Performance: Some browsers might perform better when running Jupyter Notebooks, especially when dealing with large datasets or complex visualizations.
  • Extensions and Add-ons: You might have specific browser extensions or add-ons installed that enhance your productivity and workflow.
  • Personal Preference: You might simply prefer the look and feel of a different browser or find it more comfortable to work with.

With these considerations in mind, let’s dive into the step-by-step guide on changing the default browser used by Jupyter Notebook in Windows.

Step by Step Guide to Change the Default Browser

Follow these steps to change the default browser for Jupyter Notebook in Windows:

Step 1: Locate the Jupyter Configuration File

Jupyter Notebook stores its configuration settings in a file called jupyter_notebook_config.py. First, you need to locate this file. It is typically found in the .jupyter folder within your user directory. The path should look like this:

C:\Users\<your-username>\.jupyter\jupyter_notebook_config.py

If the file does not exist, you can create one by running the following command in the Command Prompt or PowerShell:

jupyter notebook --generate-config

This command will create the jupyter_notebook_config.py file in the .jupyter folder.

Step 2: Edit the Jupyter Configuration File

Open the jupyter_notebook_config.py file in your favorite text editor. You’ll find many lines of configuration settings commented out with a # symbol at the beginning of the line.

Search for the line containing the following setting:

#c.NotebookApp.browser = ''

This line sets the default browser for Jupyter Notebook. Uncomment the line by removing the # symbol at the beginning of the line.

Step 3: Specify the Browser Executable Path

Now you need to provide the path to the browser executable you want to use as the default browser. For instance, if you want to use Google Chrome, you can find its executable at the following location:

C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

Update the c.NotebookApp.browser setting in the jupyter_notebook_config.py file with the path to the browser executable, enclosed in single or double quotes. Make sure to use double backslashes (\\) to escape the backslashes in the path. For example:

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

Save the changes and close the text editor.

Step 4: Test the New Default Browser

To test the new default browser setting, open the Command Prompt or PowerShell and run the following command:

jupyter notebook

Jupyter Notebook should now open in the browser specified in the jupyter_notebook_config.py file.

Conclusion

In this blog post, we’ve discussed the reasons you might want to change the default browser used by Jupyter Notebook in Windows. We’ve also provided a step-by-step guide to help you achieve this, from locating the Jupyter configuration file to specifying the browser executable path.

By customizing the default browser for Jupyter Notebook, you can enhance your productivity, improve performance, and enjoy a more comfortable user experience tailored to your preferences. Happy coding!


About Saturn Cloud

Saturn Cloud is your all-in-one solution for data science & ML development, deployment, and data pipelines in the cloud. Spin up a notebook with 4TB of RAM, add a GPU, connect to a distributed cluster of workers, and more. Request a demo today to learn more.