0
votes

I've tried the following as suggested in this discussion but it isn't working.

  1. c.NotebookApp.browser = '"C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" %s'

  2. c.NotebookApp.browser = '"C:/Windows/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe" %s'

  3. c.NotebookApp.browser = 'C:/Windows/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe %s'

  4. c.NotebookApp.browser = 'C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe %s'

After launching Jupyter Notebook the command prompt is opening but the Edge isn't starting with the notebook. Chrome is my default browser in the system and I'd like to keep it that way. I'm getting the following message in the Jupyter Notebook command prompt window

[I 16:23:06.903 NotebookApp] JupyterLab extension loaded from C:\Users\Pradip\anaconda3\lib\site-packages\jupyterlab

[I 16:23:06.903 NotebookApp] JupyterLab application directory is C:\Users\Pradip\anaconda3\share\jupyter\lab

[I 16:23:06.918 NotebookApp] Serving notebooks from local directory: C:\Users\Pradip

[I 16:23:06.918 NotebookApp] The Jupyter Notebook is running at:

[I 16:23:06.918 NotebookApp] http://localhost:8888/?token=60755565b267fb954a464066911e94ca39fab27da2c067d2

[I 16:23:06.918 NotebookApp] or http://127.0.0.1:8888/?token=60755565b267fb954a464066911e94ca39fab27da2c067d2

[I 16:23:06.918 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[C 16:23:06.996 NotebookApp]

To access the notebook, open this file in a browser:
    file:///C:/Users/Pradip/AppData/Roaming/jupyter/runtime/nbserver-12016-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=60755565b267fb954a464066911e94ca39fab27da2c067d2
 or http://127.0.0.1:8888/?token=60755565b267fb954a464066911e94ca39fab27da2c067d2
4

4 Answers

0
votes

Paste the target link inside the single quotes and make sure you delete the double quotes and use forward slashes in your path. (Backslashes are use in double quotes, Forward slashes in single quotes)

Add %s before closing the single quote, so it reads the path as a browser command and add the letter u before the first single quote to indicate this is a unicode string c.NotebookApp.browser = u'BROWSER TARGET LINK HERE %s'

0
votes

"anaconda" opens the browser that you have by default in your operating system. So the easiest option is change the default browser of the system

0
votes

After a lot of searching and frustration at attempts that did not work, I found the solution with help from this post in conjunction with John Lang's response in the comments.

Step 1. Open Anaconda Prompt (CMD.exe Prompt) from the Anaconda Start Menu and type

a. for jupyter notebook:

jupyter notebook --generate-config

b. for jupyter lab:

jupyter lab --generate-config

Step 2. This will generate a file name (e.g. C:\Users......\.jupyter\jupyter_lab_config.py) that you have to locate on your computer and "open with" NotePad.

Step 3. Edit the line #c.NotebookApp.browser = '' or #c.LabApp.browser = '' to include the path of the browser you would like to open jupyter notebook or jupyter lab with (I have used FireFox in my example):

c.NotebookApp.browser = '"C:\\Program Files\\Mozilla Firefox\\firefox.exe" %s'

or

c.LabApp.browser = '"C:\\Program Files\\Mozilla Firefox\\firefox.exe" %s'

Notes for this step:

  1. Pay attention to the single and double quotes
  2. Make sure there are two backslashes between items
  3. Don't forget the %s
  4. Don't forget to remove the # at the start of the line
  5. If you don't know what the path of your browser is, look it up on "windows start" button and open the file location. Right click on the app and click on properties. The path will be there.

Step 4. Save the NotePad file and relaunch jupyter notebook or jupyter lab. It should now be opening on your chosen browser, regardless of what your default browser is.

0
votes

If you are using Jupyter Lab, with version 3.0.15, then following are the steps you can follow:

  1. Open terminal/ CMD, and type jupyter-lab --generate-config
  2. Navigate to C:\Users\user_name\.jupyter and open the Python file jupyter_lab_config.py
  3. You will need to change c.ServerApp.browser
  4. Put the path of the browser, followed by a space and %s all within a single " ".
  5. Remember to uncomment this line before saving the file.
  6. Double check- this line should be commented out in this Python file: # c.ServerApp.open_browser = False

For example, I wanted to use Microsoft Edge as my default browser for Jupyter Lab. So, for me:

c.ServerApp.browser = 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe %s'
  • Now navigate to the folder you want to open your Jupyter Lab.
  • Open CMD at that location, and type jupyter-lab in CMD.

You should be good to go now with your selected browser opening for the Jupyter Lab.