-
Notifications
You must be signed in to change notification settings - Fork 293
Connecting to a remote Jupyter server from vscode.dev
You can connect to a remote Jupyter server from vscode.dev by going into the Kernel Picker of a Notebook and then selecting Select Kernel -> Existing Jupyter Server
and then entering the Url
When this quick pick comes up, pick 'Existing Jupyter Server':
On the next step, enter the URI of your Jupyter server:
This should then allow you to pick a kernel from your jupyter server when opening a notebook:
If you're starting this server yourself, there are some special requirements to get it to work in the browser:
The server has to be started with an 'allow_origin' or 'allow_origin_pat' to allow a browser to connect.
For vscode.dev, this origin is special. You'd start your server with either of the following:
jupyter notebook --no-browser --NotebookApp.allow_origin_pat=https://.*vscode-cdn\.net
or
jupyter notebook --no-browser --NotebookApp.allow_origin='*'
.
Using https://vscode.dev
as the allow_origin doesn't work because vscode-dev doesn't run extensions at the same URL as the UI. This is a security measure to prevent extensions on different tabs from talking to each other.
If you have the wrong allow_origin
set, the Developer Tools console on the browser will show something like so:
If Jupyter Server is running on your local machine, your browser might prevent access to this locally running Jupyter application from public websites such as
To address this, the following setting would also need to be configured in the configuration file.
- Create the configuration file as per the Jupyter Lab documentation
- Run the following command in the terminal
python -m jupyter --generate-config
orjupyter --generate-config
- The full path to the generated configuration file will be printed in the terminal
- Run the following command in the terminal
- Edit the configuration file to add the following section
c.ServerApp.tornado_settings = {
'headers': {
'Access-Control-Allow-Private-Network': 'true',
},
}
You can learn more about the need for this header here Private Network Access: introducing preflights
If you're using https, the certificate provided must be trusted by the browser. When this error occurs, the jupyter extension just receives unable to fetch. You can see the results in the network tab for Developer Tools:
The way to enable an untrusted certificate is to open the jupyter server's URI in the browser. It should show something like so:
If you trust the server (maybe because it's your local machine), you can add this untrusted certificate to the browser. If you reconnect from vscode.dev after that point, it should work.
If the URL for the server works in the browser, but you still cannot connect, please log an issue.
- Contribution
- Source Code Organization
- Coding Standards
- Profiling
- Coding Guidelines
- Component Governance
- Writing tests
- Kernels
- Intellisense
- Debugging
- IPyWidgets
- Extensibility
- Module Dependencies
- Errors thrown
- Jupyter API
- Variable fetching
- Import / Export
- React Webviews: Variable Viewer, Data Viewer, and Plot Viewer
- FAQ
- Kernel Crashes
- Jupyter issues in the Python Interactive Window or Notebook Editor
- Finding the code that is causing high CPU load in production
- How to install extensions from VSIX when using Remote VS Code
- How to connect to a jupyter server for running code in vscode.dev
- Jupyter Kernels and the Jupyter Extension