VSCode to Jupyter: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 18: Line 18:


Copy this token. You won't be able to see it again, but you can always come back here to get a new one.
Copy this token. You won't be able to see it again, but you can always come back here to get a new one.
After that, start your Jupyter Server.


6) In the VSCode, open the command palette. You can also use hotkey ('Cmd+Shift+P' on MacOS, 'Ctrl+Shift+P' elsewhere)
6) In the VSCode, open the command palette. You can also use hotkey ('Cmd+Shift+P' on MacOS, 'Ctrl+Shift+P' elsewhere)

Latest revision as of 16:11, 20 September 2024

Our HPC (Anunna) has its Jupyter Server

If you want to connect your local VSCode (Visual Studio Code) to the Jupyter Server with certain kernel, taking Python kernel as an example, you should try:

1) Upgrade your VSCode app to the latest version. (You could firstly skip this step, however, do it if the following steps can't make a sucessful connection).

2) In the VSCode, install (or upgrade if exists) the latest version of Jupyter(Jupyter Extension for Visual Studio Code).

3) In the VSCode, install (or upgrade if exists) the latest version of Python(Python extension for Visual Studio Code). Change Python extension to R or Julia, in the case of R or Julia kernels.

4) Open Jupyter Server in the browser, login with userID and credentials.

5) From the top menu, click "Token", and click "Request new API token". (You can leave the options by default)

Then you will get your new API Token, for example: 123456789abcdefg987654321

Copy this token. You won't be able to see it again, but you can always come back here to get a new one.

After that, start your Jupyter Server.

6) In the VSCode, open the command palette. You can also use hotkey ('Cmd+Shift+P' on MacOS, 'Ctrl+Shift+P' elsewhere)

6.1) Then type> create: New Jupyter Notebook

Or, click menu "File" -> "New File..." and select "Jupyter Notebook".

6.2) Now you are in the ipynb editing mode. On the right up corner, click "Select Kernel" and choose "Existing JupyterHub Server..."

6.3) Enter the remote URL by: https://notebook.anunna.wur.nl

Then follow the prompt and key in your userID and the API Token created in step 5)

And give a server name that you prefer.

7) Now VSCode is trying to connect the remote Jupyter server that started in step 4)

And you can see the bottom-right the info like Connecting to JupyterHub Server...

Once it connects, choose a proper kernel that you want.

8) If everything goes well, you should be able to code in VSCode and execute with the remote kernel.