7

I have opened my .ipynb file with vscode (Python 3.9 Interpreter - installed jupyterlab), it's connected locally, how can I open it through the browser? what is the default port?

rioV8
  • 24,506
  • 3
  • 32
  • 49
Ali Abdi
  • 408
  • 7
  • 21

4 Answers4

6

Type: jupyter notebook in vscode terminal (Ctrl + Shift + ~) and it will start Jupyter in browser of your preference.

If jupyter not installed type: pip install jupyter in elevated powershell or however you prefer to do installs.

If pip not installed: python -m pip install -U pip

if python not installed I prefer to install with chocolatey and walkthrough is on their site. https://docs.python-guide.org/starting/install3/win/#install3-windows

Gregory Somers
  • 116
  • 1
  • 6
2

I do not have a solution, but only hints. You can let Code start a local server via Ctrl + Shift + P, then Jupyter connect , then select default.

Unfortunately, it's not documented how you can access the server. I gave that feedback on the documentation page.

enter image description here Source of the image: https://code.visualstudio.com/docs/python/jupyter-support#_connect-to-a-remote-jupyter-server

guerda
  • 23,388
  • 27
  • 97
  • 146
  • If in vscode I create a jupyter notebook with a kernel, does it start a jupyter server? If so, how can I find the uri of the server and can I visit this uri in web browser? – panc Jun 29 '23 at 22:00
0

You can list all running notebooks and their tokens by typing jupyter notebook list in the terminal.
It will output something like this:

Currently running servers:
http://localhost:8889/?token=your_token :: /directory

You can click on the link to open it in the browser.

0

A solution for CORS-related issues:

In my case, the problem was in my CORS configuration. What fixed it for me was launching the notebook from the terminal with the allowed origin specified:

jupyter notebook --no-browser --NotebookApp.allow_origin_pat=https://.*vscode-cdn\.net

If, for some reason, that doesn't work, you could try the following as a last resort (bearing in mind this will allow ANY origin):

jupyter notebook --no-browser --NotebookApp.allow_origin='*'

Source:

https://github.com/microsoft/vscode-jupyter/wiki/Connecting-to-a-remote-Jupyter-server-from-vscode.dev

Justin Dehorty
  • 1,383
  • 1
  • 15
  • 26