pd441
pd441

Reputation: 2773

how to open Jupyter notebook in chrome on windows

On my Windows PC, i have anaconda installed and when I open a jupyter notebook, it opens up in internet explorer, but I would like to use Chrome instead. Does anyone know how to achieve this?

Upvotes: 65

Views: 318641

Answers (18)

Dr_Be
Dr_Be

Reputation: 252

On my (somewhat older and outdated) Anaconda installation on Windows 10 using the --browser option did not work. I could not use Jupyter Lab due to an outdated browser.

So I had to look for an alternative which for me was setting the environment variable BROWSER pointing to the browser program file. So by performing a

set BROWSER=C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe

in a command shell (or Powershell with the appropriate command), Jupyter [Lab] afterwards started by using the MS Edge browser, just as wanted. Any other browser can be used by providing the path to it via setting BROWSER. I've adjusted my batch file accordingly so I can now use Jupyter Lab.

Upvotes: 0

Ashish
Ashish

Reputation: 91

I faced the same issue Installed Anaconda in new laptop and when started Jupyter notebook by default it opened in edge, given my default browser is Chrome.

I just change 'default browser' setting to edge and then again switch to chrome. After this trick, Jupyter is opening in chrome.

Upvotes: 0

vivek sharma
vivek sharma

Reputation: 379

I just followed 2 steps and everythings working as expected

step-1 set chrome executable path environment varibale, in my case it is(you can test it in cmd by typing chrome and enter, it will open your chrome browser if path set properly):-

C:\Program Files\Google\Chrome\Application\chrome.exe

step-2 just run below command and you are good to go

jupyter notebook --browser chrome

Upvotes: 4

Ale
Ale

Reputation: 1004

Create and edit the jupyter notebook config file with the following steps:

  • Launch Anaconda Prompt
  • Type jupyter notebook --generate-config
  • Type notepad path_to_file/jupyter_notebook_config.py to open it (change path_to_file)
  • Modify #c.NotebookApp.browser = '' to c.NotebookApp.browser = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
  • Save the file and close it

Jupyter notebook will now use Chrome.

EDIT

In Windows 10 I had to type

  • notepad .jupyter/jupyter_notebook_config.py

And substitute the line with

  • c.NotebookApp.browser = 'C:/Program Files/Google/Chrome/Application/chrome.exe %s'

Upvotes: 20

DevilWhite
DevilWhite

Reputation: 49

In the windows when we open jupyter notebook in command prompt we can see the instructions in first 10 lines in that there is one instruction- "to open notebook, open this file in browser file://C:/Users/{username}/appdata/roaming/jupyetr/runtime/nbserver-xywz-open.html " , open this html with browser of your choice.

Upvotes: 1

Angelo
Angelo

Reputation: 361

See response on this thread that has worked for me:

https://stackoverflow.com/a/62275293/11141700

NOTE - Additional STEP 3 that has made the difference for me compared to similar approaches suggested here

In short:

Step 1 - Generate config for Jupyter Notebook:

jupyter notebook --generate-config

Step 2 - Edit the config file using "nano" or other editor

The config fileshould be under your home directory under ".jupyter" folder:

~/.jupyter/jupyter_notebook_config.py

Step 3 - Disable launching browser by redirecting file

First comment out the line, then change True to False:

c.NotebookApp.use_redirect_file = False

Step 4 - add a line to your .bashrc file to set the BROWSER path

export BROWSER='/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'

For me it was Chrome under my Windows Program File. Otherwise any linux installation under WSL doesn't have a native browser to launch, so need to set it to the Windows executable.

Step 5 - restart .bashrc

source .bashrc

Upvotes: 2

jorge
jorge

Reputation: 396

I just set chrome as my default browser and jupyter launches in Chrome now.

However, we have also the following approach, but it did not work for me:

"CONDA version 4.7.5 and jupyter 6.0.0. - Windows 10"

1) Open Anaconda and launch your environment in terminal

enter image description here

2) Create config file and open file in notepad

enter image description here

3) Modify line of NotebookApp with chrome and save modification

enter image description here

4) Launch Jupyter

:( ... but it still launches in Mozilla.

Upvotes: 0

icalvo
icalvo

Reputation: 111

If you tried all these "solutions" and still doesn't work, try to open the url over HTTP (not HTTPS <-- the real problem with chrome) and using an Incognito window (press Ctrl + Shift + N on Chrome)

This worked for me. Hope it helps

Upvotes: 0

Rich_Foley
Rich_Foley

Reputation: 61

For some reason Louise's answer didn't work for me I had to:

-Open anaconda prompt and generate the config file for Jupyter: jupyter notebook --generate-config

-Open the newly created config file at: C:\Users\builder\.juptyer\jupyter_notebook_config.py

-Add the following to the file:

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

Upvotes: 5

Maz
Maz

Reputation: 71

I found an easier solution that may help beginners to coding.

go to

C:\Users\'-your user-'\AppData\Roaming\jupyter\runtime

and find a file named

nbserver-6176-open.html

then

Right-click > open with > Choose default program...

Here, what ever you choose would be saved on your Windows to open all HTML files; therefore when you run Jupyter notebook, it would open in the program you want.

Upvotes: 7

Nan  Sun
Nan Sun

Reputation: 51

You don't have to change anything in the jupyter config code, you just have to make Chrome as your default browser in the setting. Jupyter opens whichever is the default.

Upvotes: 5

Mimansa
Mimansa

Reputation: 101

step1: Go to search menu of windows and type default app.

step 2: go to WEB BROWSER title and change it to Google Chrome.

step3: Go to search menu of windows and type jupyter notebook

This will open the jupyter notebook in Google Chrome

Upvotes: 10

Louise Davies
Louise Davies

Reputation: 15981

If you haven't already, create a notebook config file by running

jupyter notebook --generate-config

Then, edit the file jupyter_notebook_config.py found in the .jupyter folder of your home directory.

You need to change the line # c.NotebookApp.browser = '' to c.NotebookApp.browser = 'C:/path/to/your/chrome.exe %s'

On windows 10, Chrome should be located C:/Program Files (x86)/Google/Chrome/Application/chrome.exe but check on your system to be sure.

Upvotes: 88

Layla Michan Aguirre
Layla Michan Aguirre

Reputation: 71

For windows set the default browser to open html files to Chrome. Configuration > Default Apps > Default Apps by File Type. Worked for me.

Upvotes: 7

Kenny
Kenny

Reputation: 391

For those who still have trouble launching Chrome automatically from cmd, try replacing

# c.NotebookApp.browser =''

in the file jupyter_notebook_config.py with

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

or the appropriate location, there shouldn't be need to install anything via pip.

Ref: https://support.anaconda.com/customer/en/portal/articles/2925919-change-default-browser-in-jupyter-notebook

Upvotes: 29

Tejas Kothari
Tejas Kothari

Reputation: 95

Take any html file on your computer and set the default browser to open html files to chrome. This will automatically open jupyter notebook with chrome. Worked for me.

Upvotes: 7

jitsbits
jitsbits

Reputation: 448

Just make chrome as a default browser and launch the jupyter . It will work

To Make Google chrome a default browser , follow steps

  1. Click on Customize and Control Google chrome (The vertical three dots on the Upper right corner of your google chrome browser)
  2. Click on Settings and scroll down to Default browser.
  3. Change the value of the default browser to Google Chrome by clicking on whatever your default browser is there and selecting Google Chrome.

Note:

In windows 10, you will be redirected to Default apps under your computer's Settings. Please scroll down to Web browser and Select Google Chrome. If promted, Click on OK else just close the settings tab and return to your command or anaconda prompt and type jupyter notebook as usual. A new jupyter notebook tab should open in Google Chrome now.

Upvotes: 34

Dudi Rendusara
Dudi Rendusara

Reputation: 91

  • Run the jupyter notebook --generate-config command on the anaconda prompt.
  • Then edit the jupyter_notebook_config.py file.

Find the c.NotebookApp.Browser like this:

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

Works on mine.

Upvotes: 9

Related Questions