Opened 2 years ago

Closed 2 months ago

#30484 closed enhancement (fixed)

Document using Sage on Windows via Visual Studio Code with WSL remote

Reported by: Matthias Köppe Owned by:
Priority: critical Milestone: sage-9.7
Component: user interface Keywords:
Cc: Tobias Diez, Emmanuel Charpentier, Thierry Monteil, Karl-Dieter Crisman, gh-louisng, Kwankyu Lee, Travis Scrimshaw, Samuel Lelièvre Merged in:
Authors: Louis Ng, Matthias Koeppe Reviewers: Tobias Diez, Kwankyu Lee
Report Upstream: N/A Work issues:
Branch: 79552c6 (Commits, GitHub, GitLab) Commit: 79552c66bcabdbc76caf00e404ac02e284835893
Dependencies: #33131, #33103 Stopgaps:

Status badges

Description (last modified by Kwankyu Lee)

We already have a basic VS Code configuration; #33103 makes some minor updates.

In this ticket, we add documentation for installing VS Code on Windows and setting up the WSL remote, as the primary way how to use Sage on Windows. This goes to

Next task: cross reference it from the developer's guide and add information there on how to develop Sage on Windows.

References:

Attachments (1)

Screenshot 2022-04-08 201448.png (22.9 KB) - added by Tobias Diez 6 months ago.

Download all attachments as: .zip

Change History (44)

comment:1 Changed 2 years ago by Tobias Diez

A basic how to setup VS code for sage (from https://trac.sagemath.org/ticket/25206#comment:63):

comment:2 Changed 2 years ago by Matthias Köppe

Should also add instructions for cygwin shell under VS code; random link - https://superuser.com/questions/1511487/cygwin-shell-in-vs-code-tries-to-activate-conda-how-to-prevent-this

comment:3 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2sage-9.3

comment:4 in reply to:  1 Changed 2 years ago by Dima Pasechnik

Replying to gh-tobiasdiez:

  • Use ./sage -br to trigger a rebuild of sage.

I'd suggest make build && ./sage instead.

comment:5 Changed 19 months ago by Matthias Köppe

Milestone: sage-9.3sage-9.4

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.

comment:6 Changed 14 months ago by Matthias Köppe

Milestone: sage-9.4sage-9.5

comment:7 Changed 12 months ago by Matthias Köppe

Dependencies: #30677

comment:8 Changed 10 months ago by Matthias Köppe

Milestone: sage-9.5sage-9.6

comment:9 Changed 9 months ago by Matthias Köppe

Summary: Visual Studio (vscode) configurationDocumentation/configuration for Visual Studio (vscode) with a WSL remote

comment:10 Changed 9 months ago by Matthias Köppe

Cc: Emmanuel Charpentier Thierry Monteil Karl-Dieter Crisman added
Dependencies: #30677#33131, #33103
Description: modified (diff)
Summary: Documentation/configuration for Visual Studio (vscode) with a WSL remoteDocumentation/configuration for Sage on Windows using Visual Studio (vscode) with a WSL remote

comment:11 Changed 6 months ago by Dima Pasechnik

Hmm, I can't figure out how to use vscode with a Sage notebook. The problem is to get vscode to find the correct kernel...

comment:12 Changed 6 months ago by Tobias Diez

At least for a "normal" jupyter notebook, selecting the venv created by sage worked for me.

There is also the possibility to connect to a "remote" jupyter instance. https://code.visualstudio.com/docs/datascience/jupyter-notebooks#_connect-to-a-remote-jupyter-server So if you start sage's jupyter server, you should be able to connect to it in this way.

comment:13 in reply to:  12 Changed 6 months ago by Dima Pasechnik

Replying to gh-tobiasdiez:

At least for a "normal" jupyter notebook, selecting the venv created by sage worked for me.

The question is, how does vscode's jupyter discover kernels? Where? What should be set?

There is also the possibility to connect to a "remote" jupyter instance. https://code.visualstudio.com/docs/datascience/jupyter-notebooks#_connect-to-a-remote-jupyter-server So if you start sage's jupyter server, you should be able to connect to it in this way.

Changed 6 months ago by Tobias Diez

comment:14 Changed 6 months ago by Tobias Diez

In the upper right corner you can select the kernel/python version, see attached screenshot.

comment:15 Changed 6 months ago by Matthias Köppe

Cc: gh-louisng added

comment:16 Changed 6 months ago by gh-louisng114

comment:17 Changed 6 months ago by Matthias Köppe

Not sure if it has just moved or this is a different document: https://code.visualstudio.com/docs/remote/wsl

comment:19 in reply to:  14 Changed 6 months ago by Dima Pasechnik

Replying to gh-tobiasdiez:

In the upper right corner you can select the kernel/python version, see attached screenshot.

it's rather unpredictable whether Sage jupyter kernel will be available. Often it's just not there.

Version 0, edited 6 months ago by Dima Pasechnik (next)

comment:20 Changed 6 months ago by Matthias Köppe

Description: modified (diff)

comment:22 Changed 6 months ago by gh-louisng114

Branch: public/30484
Commit: 8a4eb057f90f1147d20a823f2d6461d8dfb7459c

comment:23 Changed 6 months ago by Matthias Köppe

Authors: Louis Ng
Status: newneeds_review

comment:24 Changed 6 months ago by Tobias Diez

Reviewers: Tobias Diez
Status: needs_reviewneeds_work

The changes mostly look good to me, but I think the ticket originally had a broader scope than only the configuration for Jupiter notebooks.

Moreover, according to https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette Ctrl + Shift + P is the default/recommended shortcut to open the command palette. Maybe rephrase this part as In the command palette (Ctrl + Shift + P), choose "xyz"?

comment:25 Changed 6 months ago by git

Commit: 8a4eb057f90f1147d20a823f2d6461d8dfb7459c6881dd6e7ee964603a40b32e243538877e1d0aee

Branch pushed to git repo; I updated commit sha1. New commits:

6881dd6Changed phrasing regarding the command palette

comment:26 Changed 6 months ago by Matthias Köppe

On macOS, its Cmd + Shift + P. Perhaps also include the link to the VS Code documentation?

comment:27 in reply to:  25 Changed 6 months ago by Tobias Diez

Replying to git:

Branch pushed to git repo; I updated commit sha1. New commits:

6881dd6Changed phrasing regarding the command palette

Thanks!

comment:28 Changed 6 months ago by Matthias Köppe

Priority: majorcritical

comment:29 Changed 5 months ago by Matthias Köppe

Milestone: sage-9.6sage-9.7

comment:30 Changed 2 months ago by git

Commit: 6881dd6e7ee964603a40b32e243538877e1d0aeeb0c907eeb502b43be3bc63423b8989efa776f8cc

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

b29ccb9added VC Code WSL Jupyter section
8389ebcChanged phrasing regarding the command palette
b0c907esrc/doc/en/installation/launching.rst: Add markup for key chords

comment:31 Changed 2 months ago by Matthias Köppe

Status: needs_workneeds_review

comment:32 Changed 2 months ago by Matthias Köppe

Cc: Kwankyu Lee added

comment:33 Changed 2 months ago by Matthias Köppe

Cc: Travis Scrimshaw Samuel Lelièvre added

comment:34 Changed 2 months ago by Kwankyu Lee

I am new to the Visual Studio Code interface to the sagemath installed in WSL.

I followed the guide of the branch of this ticket. It mostly worked.

But in the first attempt, I could not select SageMath kernel in the jupyter notebook. It was simply missing.

I wandered around for some time, and then found Jupyter Extension in the Extensions panel. I installed it, and did the ":Create: New Jupyter Notebook" thing again. Then I could finally select SageMath kernel.

So it seems that there is a missing step in the guide: "Install Jupyter Extension"

Anyway, this VSCode interface to sage is very nice!

Still it was not straightforward for me to setup the working jupyter notebook with sagemath kernel starting from building sage from source in WSL.

comment:35 Changed 2 months ago by Matthias Köppe

Thanks for testing it! I'll add this step

comment:36 Changed 2 months ago by git

Commit: b0c907eeb502b43be3bc63423b8989efa776f8cc79552c66bcabdbc76caf00e404ac02e284835893

Branch pushed to git repo; I updated commit sha1. New commits:

79552c6src/doc/en/installation/launching.rst: Also mention Jupyter Extension

comment:37 Changed 2 months ago by Matthias Köppe

Authors: Louis NgLouis Ng, Matthias Koeppe

comment:38 in reply to:  35 Changed 2 months ago by Kwankyu Lee

Reviewers: Tobias DiezTobias Diez, Kwankyu Lee
Status: needs_reviewpositive_review

Replying to mkoeppe:

Thanks for testing it! I'll add this step

Thanks. It looks good to me.

comment:39 Changed 2 months ago by Kwankyu Lee

Summary: Documentation/configuration for Sage on Windows using Visual Studio (vscode) with a WSL remoteDocumentation for Sage on Windows using Visual Studio (vscode) with WSL remote

comment:40 Changed 2 months ago by Kwankyu Lee

Summary: Documentation for Sage on Windows using Visual Studio (vscode) with WSL remoteDocument using Sage on Windows via Visual Studio Code with WSL remote

comment:41 Changed 2 months ago by Kwankyu Lee

Description: modified (diff)

comment:42 Changed 2 months ago by Matthias Köppe

Thanks!

comment:43 Changed 2 months ago by Volker Braun

Branch: public/3048479552c66bcabdbc76caf00e404ac02e284835893
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.