This guide provides instructions on how to configure Jupyter Notebook to open with a preferred web browser, such as Firefox or Google Chrome, instead of your system’s default browser. While the steps illustrate how to set Firefox as the default browser on Ubuntu, we also include details for Google Chrome users.
Step-by-Step Guide
The following steps will show you how to set your default browser for Jupyter on Ubuntu.
Step 1: Check the Browser Installation
Ensure that Firefox or Google Chrome is installed on your system. To verify this, run one of the following commands in the terminal:
For Firefox:
firefox --version
For Google Chrome:
google-chrome --version
These commands will return the current version of the installed browser. If the browser is not installed, use sudo apt install firefox or sudo apt install google-chrome-stable to install it
Step 2: Generate a Jupyter Configuration File
If you don’t already have a Jupyter configuration file, generate one with the following command:
jupyter notebook --generate-config
This command creates a file named jupyter_notebook_config.py
in the ~/.jupyter/ directory
.
Step 3: Modify the Configuration File
Open the configuration file in a text editor. For example, if using vim, the command would be vim ~/.jupyter/jupyter_notebook_config.py
.
Search for the line #c.ServerApp.browser = ''
. If it’s not present, add it at the end of the file.
Uncomment this line by removing the # at the start. Replace the empty quotes with ‘firefox’ for Firefox users, or ‘google-chrome’ for Google Chrome users. The line should look like this:
For Firefox:
c.ServerApp.browser = 'firefox'
For Google Chrome:
c.ServerApp.browser = 'google-chrome'
Save and close the configuration file.
Next Steps
Now that you’ve set your default browser, you may want to update your Jupyter Notebook environment variables.
Conclusion
Now, whenever you start Jupyter Notebook, it will open in the chosen browser by default. This guide provides a straightforward way to change the default browser for Jupyter Notebook to Firefox or Google Chrome on Ubuntu.
The same method can be applied to set any web browser as the default, provided it’s installed on your system and launched from the terminal.
Frequently Asked Questions
What is the default Jupyter Notebook URL?
The default Jupyter Notebook URL is http://localhost:8888/. When you start the Jupyter server, it runs locally on port 8888 by default.
How do I open a Jupyter Notebook in Ubuntu?
To open a Jupyter Notebook in Ubuntu, navigate to your project directory in the terminal and run the command jupyter notebook. This will start Jupyter.
How do I open a Jupyter Notebook in Ubuntu?
To open a Jupyter Notebook in Ubuntu, navigate to your project directory in the terminal and run the command jupyter notebook. This will start the Jupyter server and open a new tab in your default web browser with the Jupyter interface.