Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXTERNAL] Python kernel with C# cell doesn't execute with C# kernel #1122

Closed
2 of 14 tasks
Xarkam opened this issue Mar 3, 2021 · 10 comments
Closed
2 of 14 tasks

[EXTERNAL] Python kernel with C# cell doesn't execute with C# kernel #1122

Xarkam opened this issue Mar 3, 2021 · 10 comments

Comments

@Xarkam
Copy link

Xarkam commented Mar 3, 2021

Describe the bug

Can't execute C# code into ipynb file in vscode stable. But with jupyter-lab I can:
image

Please complete the following:

Which version of .NET Interactive are you using? There are a few ways to find this out:
1.0.215204

  • In a notebook, run the #!about magic command.
    Nothing, just say 0.6s
    image
    image

  • At the command line, run dotnet interactive --version.
    1.0.215204+974732778592b69c526648c54ef4c48219058e97

  • OS
    • Windows 10
    • macOS
    • Linux KDE Neon
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge
    • Firefox
    • Safari
  • Frontend
    • Jupyter Notebook
    • Jupyter Lab
    • nteract
    • Visual Studio Code
    • Other (please specify)

Screenshots

image
image
image
image
image

Linux Distribution

image

@colombod
Copy link
Member

colombod commented Mar 6, 2021

What extension do you have? It seems that the code is sent to a python kernel. Despite the language selected in the cell can you verify that you are using the .NET Interactive kernel by using the command palette and then start looking for the choose kernel command?

@Xarkam
Copy link
Author

Xarkam commented Mar 6, 2021

Hi,
That's right, despite the choice of .NET Interactive, it is positioned on python.
image

@colombod
Copy link
Member

colombod commented Mar 6, 2021

How are you opening the notebook?

@colombod
Copy link
Member

colombod commented Mar 6, 2021

@brettfo do you have any suggestion?

@Xarkam
Copy link
Author

Xarkam commented Mar 6, 2021

How are you opening the notebook?

How I'm opening ? Tutorial https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode
I just follow the indications of the "doc"

@colombod
Copy link
Member

colombod commented Mar 6, 2021

can you check if the the settings for your extension look like this?
image

@Xarkam
Copy link
Author

Xarkam commented Mar 6, 2021

image
Not checked by default on my installation.

Edit: On each new notebook, if I select .NET Interactive for a block of code, the active kernel not switch to .NET Interactive

@jonsequitur
Copy link
Contributor

You typically have to select the kernel before the language chooser will work correctly. The experience is still awkward there.

If you're still seeing output from Python instead of .NET, try opening the VS Code command palette, select View: Reopen Editor With..., and select .NET Interactive for Jupyter.

@Xarkam
Copy link
Author

Xarkam commented Mar 6, 2021

You typically have to select the kernel before the language chooser will work correctly. The experience is still awkward there.

If you're still seeing output from Python instead of .NET, try opening the VS Code command palette, select View: Reopen Editor With..., and select .NET Interactive for Jupyter.

Thank you. So while waiting for the experience to become satisfactory, wouldn't it be wise to add a section in the doc for this kind of problem?

@brettfo
Copy link
Member

brettfo commented Mar 22, 2021

This has been a major point of confusion for users in the past.

The issue appears to be that the Python kernel was selected for the notebook, but the individual cell's language was set to "C# (.NET Interactive)" so editor language services were getting routed to C# appropriately, but cell execution was honoring the kernel.

There are two related issues open against the Jupyter extension, microsoft/vscode-jupyter#4510 and microsoft/vscode-jupyter#4490 that call out how a kernel can (and should?) restrict it's language list, so the Python kernel should ideally not list C# as a possible language.

@brettfo brettfo changed the title Cannot run C# code into interactive notebook in vscode [EXTERNAL] Python kernel with C# cell doesn't execute with C# kernel Mar 22, 2021
@brettfo brettfo closed this as completed Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants