interactive icon indicating copy to clipboard operation
interactive copied to clipboard

failed to connect jupyter

Open hjy1210 opened this issue 1 year ago • 1 comments

Describe the bug

I try to use Polyglot notebook extension with mixed csharp and python in Visual Studio Code. My steps are:

  1. notebook use .NET Interactive as kernel
  2. add csharp cell and execute, OK
  3. add html content and execute, OK
  4. use magic command #!connect jupyter --kernel-name pythonkernel --conda-env anapy310 --kernel-spec python3 to connect Python kernel, where anapy310 is my conda environment.

error occured with following message:

Error: System.ArgumentException: KernelSpec python3 not found
   at Microsoft.DotNet.Interactive.Jupyter.ZMQ.JupyterConnection.CreateKernelConnectionAsync(String kernelSpecName) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Jupyter\ZMQ\JupyterConnection.cs:line 47
   at Microsoft.DotNet.Interactive.Jupyter.JupyterKernelConnector.CreateKernelAsync(String kernelName) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Jupyter\JupyterKernelConnector.cs:line 27
   at Microsoft.DotNet.Interactive.Jupyter.ConnectJupyterKernelDirective.ConnectKernelsAsync(ConnectJupyterKernel connectCommand, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Jupyter\ConnectJupyterKernelDirective.cs:line 70
   at Microsoft.DotNet.Interactive.CompositeKernel.ConnectKernel[TCommand](TCommand command, ConnectKernelDirective`1 connectDirective, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\CompositeKernel.cs:line 253
   at Microsoft.DotNet.Interactive.CompositeKernel.<>c__DisplayClass20_0`1.<<AddConnectDirective>b__0>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\CompositeKernel.cs:line 238
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.Kernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 365
   at Microsoft.DotNet.Interactive.CompositeKernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\CompositeKernel.cs:line 194
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<BuildPipeline>b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 60
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_1.<<BuildPipeline>b__3>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 75
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.App.KernelExtensions.<>c__DisplayClass5_0.<<UseTelemetrySender>b__0>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\KernelExtensions.cs:line 296
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_1.<<BuildPipeline>b__3>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 75
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.App.KernelExtensionLoader.<>c__DisplayClass0_0.<<UseNuGetExtensions>b__0>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\KernelExtensionLoader.cs:line 25
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_1.<<BuildPipeline>b__3>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 75
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.App.KernelExtensions.<>c__DisplayClass4_0.<<UseSecretManager>b__0>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\KernelExtensions.cs:line 227
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_0.<<BuildPipeline>g__Combine|2>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 73
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_0.<<BuildPipeline>g__Combine|2>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 73
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_0.<<BuildPipeline>g__Combine|2>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 73
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 41

Note: In environment anapy310, python version is 3.10.16

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ): version of .NET Interactive is Version: 1.0.607001+e2f2a48f93b828a07ac9883477565515fa1e47bf Library version: 1.0.0-beta.25070.1+e2f2a48f93b828a07ac9883477565515fa1e47bf Build date: 2025-01-22T03:57:34.1921481Z

  • OS
    • [x] Windows 11
    • [ ] Windows 10
    • [ ] macOS
    • [ ] Linux (Please specify distro)
    • [ ] iOS
    • [ ] Android
  • Browser
    • [x] Chrome
    • [ ] Edge
    • [ ] Firefox
    • [ ] Safari
  • Frontend
    • [ ] Jupyter Notebook
    • [ ] Jupyter Lab
    • [ ] nteract
    • [x] Visual Studio Code
    • [ ] Visual Studio Code Insiders
    • [ ] Visual Studio
    • [ ] Other (please specify)

Screenshots

If applicable, add screenshots to help explain your problem.

Image

hjy1210 avatar Jan 23 '25 04:01 hjy1210

Others have reported this in #3813.

jonsequitur avatar Jan 24 '25 17:01 jonsequitur