dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.85k stars 381 forks source link

Stuck on installing .Net interactive #3233

Open flerxu opened 11 months ago

flerxu commented 11 months ago

Type: Question

  1. Install C# Dev Kit and Polyglot notebooks extension;
  2. Open command center, select "Ployglot :Create new blank notebook";
  3. Error dialog appears:
    Command 'Ployglot Notebook: Create new blank notebook  ' resulted in an error ,
    command 'polyglot-notebook.newNotebookNoDefaults' not found

Extension Log:

Extension started for VS Code Stable.
tool-uninstall: Executing [dotnet tool uninstall Microsoft.dotnet-interactive] in 'c:\Users\player\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.dotnet-interactive-vscode'.
tool-uninstall: Finished with code 0.
tool-uninstall: STDOUT:
Tool 'microsoft.dotnet-interactive' was successfully uninstalled and removed from manifest file c:\Users\player\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.dotnet-interactive-vscode\.config\dotnet-tools.json.
tool-install: Executing [dotnet tool install --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json --ignore-failed-sources Microsoft.dotnet-interactive --version 1.0.446104] in 'c:\Users\player\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.dotnet-interactive-vscode'.
tool-install: Finished with code 1.
tool-install: STDERR:
Unhandled exception: System.UnauthorizedAccessException: Access to the path 'C:\Users\player\.dotnet\toolResolverCache\1\microsoft.dotnet-interactive' is denied.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
   at Microsoft.DotNet.ToolPackage.LocalToolsResolverCache.Save(IDictionary`2 restoredCommandMap)
   at Microsoft.DotNet.Tools.Tool.Install.LocalToolsResolverCacheExtensions.SaveToolPackage(ILocalToolsResolverCache localToolsResolverCache, IToolPackage toolDownloadedPackage, String targetFrameworkToInstall)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallLocalCommand.Install(FilePath manifestFile)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Cli.Parser.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass7_0.<<UseExceptionHandler>b__0>d.MoveNext()
Error acquiring dotnet-interactive tool: undefined

Modes:

App and Extension Info dotNet Interactive extension version: 1.0.4461040 VS Code version: Code 1.83.0 (e7e037083ff4455cf320e344325dacb480062c3c, 2023-10-03T16:12:16.321Z) OS version: Windows_NT x64 10.0.22621
Extension list - GitHub.github-vscode-theme - ms-dotnettools.csdevkit - ms-dotnettools.csharp - ms-dotnettools.dotnet-interactive-vscode - ms-dotnettools.vscode-dotnet-runtime - ms-dotnettools.vscodeintellicode-csharp - ms-python.python - ms-python.vscode-pylance - ms-toolsai.jupyter - ms-toolsai.jupyter-keymap - ms-toolsai.jupyter-renderers - ms-toolsai.vscode-jupyter-cell-tags - ms-toolsai.vscode-jupyter-slideshow - ms-vscode.Theme-MaterialKit - SumitSaha.learn-with-sumit-theme
System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz (8 x 2112)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|15.76GB (10.13GB free)| |Process Argv|--crash-reporter-id 62384e17-f9d1-4d78-b095-6b26fa04322a| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 py29gd2263:30792226 vsclangdc:30486549 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30695312 azure-dev_surveyone:30548225 282f8724:30602487 f6dab269:30613381 a9j8j154:30646983 showlangstatbar:30737416 0bi6i642:30841073 03d35959:30757346 pythonfmttext:30731395 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30797651 pythonidxpt:30805730 pythonnoceb:30805159 copilotsettingc:30839828 synctok:30821570 dsvsc013:30795093 dsvsc014:30804076 diffeditorv2:30821572 pythonmhint1:30842940 dsvsc015:30845448 ```
gmartinka commented 10 months ago

I am seeing this as well. Its happening in both Cod and Code Insiders. I have tried uninstalling and reinstalling both the polyglot extension and all of VS Code. Notebooks that used to work no longer work,

This is the error I am getting when trying to open a notebook that used to work.

Using dotnet configured on PATH Dotnet path: C:\Program Files\dotnet\dotnet.exe Activating C# + C# Dev Kit + C# IntelliCode... waiting for named pipe information from server... [stdout] {"pipeName":"\\\\.\\pipe\\809cf8e8-bb66-40e7-bd29-f3394060f9d1"} received named pipe information from server attempting to connect client to server... client has connected to server [Info - 8:50:51 PM] [Program] Language server initialized [Error - 8:50:51 PM] [LanguageServerHost] System.InvalidOperationException: didOpen received for vscode-notebook-cell:/c:/source/local machine configuration/datacenter/tst_ads_sql_notebook.ipynb#W1sZmlsZQ== which is already open. - line 106 at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/Contract.cs:line 154 at Microsoft.CodeAnalysis.LanguageServer.LspWorkspaceManager.StartTrackingAsync(Uri uri, SourceText documentText, String languageId, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs:line 106 at Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges.DidOpenHandler.HandleNotificationAsync(DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs:line 42 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136 [Error - 8:50:51 PM] [LanguageServerHost] System.InvalidOperationException: didOpen received for vscode-notebook-cell:/c:/source/local machine configuration/datacenter/tst_ads_sqlnotebook.ipynb#W1sZmlsZQ== which is already open. - line 106 at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber) in //src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/Contract.cs:line 154 at Microsoft.CodeAnalysis.LanguageServer.LspWorkspaceManager.StartTrackingAsync(Uri uri, SourceText documentText, String languageId, CancellationToken cancellationToken) in //src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs:line 106 at Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges.DidOpenHandler.HandleNotificationAsync(DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) in //src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs:line 42 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue1.ProcessQueueAsync() in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 239 [Info - 8:50:51 PM] Error processing queue, shutting down [Error - 8:50:51 PM] Workspace diagnostic pull failed. Canceled: Canceled at s.handleFailedRequest (c:\Users\gmartin2\.vscode\extensions\ms-dotnettools.csharp-2.7.25-win32-x64\dist\extension.js:2:2316987) at c:\Users\gmartin2\.vscode\extensions\ms-dotnettools.csharp-2.7.25-win32-x64\dist\extension.js:2:2354399 at async g.pullWorkspaceAsync (c:\Users\gmartin2\.vscode\extensions\ms-dotnettools.csharp-2.7.25-win32-x64\dist\extension.js:2:2351707) [Error - 8:50:51 PM] The Microsoft.CodeAnalysis.LanguageServer server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

gmartinka commented 10 months ago

After running dotnet tool update --global Microsoft.dotnet-interactive and restarting Code, my notebooks are working again!

I guess there must have been a problem with updating via Code, I don't know why though.

flerxu commented 9 months ago

After running dotnet tool update --global Microsoft.dotnet-interactive and restarting Code, my notebooks are working again!

I guess there must have been a problem with updating via Code, I don't know why though.

I have tried everything but none worked. After reinstalling Windows 11 , it worked.

ferencgyenezsenio commented 9 months ago

In my case, the issue was related to Nuget. In the package source, I have multiple Nuget repos, some require authentication. Even if I try to update dotnet-interactive as @gmartinka mentioned, I would get an exception. The update tries to access the private Nuget repos, even if I set which repo should be used.

dotnet tool update --ignore-failed-sources --global Microsoft.dotnet-interactive --add-source https://api.nuget.org/v3/index.json

The solution: I've temporarily removed all custom Nuget repos from the NuGet.Config and rerun the update. In my case I just unchecked them in Rider.

C:\Users\<user>\AppData\Roaming\NuGet\NuGet.Config

update: I've added --ignore-failed-sources argument to the command

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-update

BrianL-STCU commented 9 months ago

I'm stuck at "Installing .NET Interactive version 1.0.446104", but I had version 1.0.460602 installed. I uninstalled it and installed the matching version, but I'm still stuck. I only have one NuGet source configured.

VSCode details ```text Version: 1.82.3 (user setup) Commit: fdb98833154679dbaa7af67a5a29fe19e55c2b73 Date: 2023-10-02T10:51:22.294Z (2 mos ago) Electron: 25.8.1 ElectronBuildId: 24153832 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.19045 ```
jonsequitur commented 9 months ago

@BrianL-STCU Your VS Code install looks to be somewhat out of date. Are you able to update to the latest VS Code and Polyglot Notebooks extension versions, and install the .NET 8 SDK?

BrianL-STCU commented 9 months ago

@jonsequitur keeping it up to date has become quite a hassle due to microsoft/winget-cli#3068. I didn't realize it had been two months already, but I got it updated, though unfortunately it hasn't helped.

VSCode details ```txt Version: 1.85.0 (user setup) Commit: af28b32d7e553898b2a91af498b1fb666fdebe0c Date: 2023-12-06T20:48:09.019Z (2 days ago) Electron: 25.9.7 ElectronBuildId: 25551756 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.19045 ```
BrianL-STCU commented 9 months ago

The Extension Host output shows:

2023-12-08 16:25:13.438 [error] Activating extension ms-dotnettools.dotnet-interactive-vscode failed due to an error:
2023-12-08 16:25:13.438 [error] TypeError: Cannot read properties of undefined (reading 'workingDirectory')
    at c:\Users\█████████\.vscode\extensions\ms-dotnettools.dotnet-interactive-vscode-1.0.4606020\out\src\vscode-common\extension.js:238:140
    at Generator.next (<anonymous>)
    at fulfilled (c:\Users\█████████\.vscode\extensions\ms-dotnettools.dotnet-interactive-vscode-1.0.4606020\out\src\vscode-common\extension.js:7:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
BrianL-STCU commented 9 months ago

Our decrypting firewall may be causing an issue with the download. Is there a way to manually install .NET Interactive in VSCode, since the automated step doesn't seem reliable in our environment? Or to reference the system installation which is already there?

BrianL-STCU commented 9 months ago

The version it's trying to download has been updated, but it still never completes:

Installing .NET Interactive version 1.0.460602

BrianL-STCU commented 9 months ago

I just found that in mid-November, I ran into this same problem after installing the .NET 8 preview. Uninstalling it fixed this issue then, but of course now Polyglot Notebooks requires .NET 8.

.NET installation info ```text .NET SDK: Version: 8.0.100 Commit: 57efcf1350 Workload version: 8.0.100-manifests.8d38d0cc Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.100\ .NET workloads installed: Workload version: 8.0.100-manifests.8d38d0cc There are no installed workloads to display. Host: Version: 8.0.0 Architecture: x64 Commit: 5535e31a71 .NET SDKs installed: 6.0.417 [C:\Program Files\dotnet\sdk] 7.0.404 [C:\Program Files\dotnet\sdk] 8.0.100 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download ``` ```text Package Id Version Commands ------------------------------------------------------------------------------------------------ microsoft.dotnet-interactive 1.0.460602 dotnet-interactive ```
BrianL-STCU commented 9 months ago

I think I may have correlated the problem with our firewall. I'll report back if that turns out to be the problem. It could be that the download URL is very triggering to certain enterprise security.

BrianL-STCU commented 8 months ago

Confirmed that was my problem.

Puiu commented 3 months ago

I was having the same problem when VS Code tried to install dotnet-interactive. I then tried to install the tool using dotnet tool install command but got this error:

"Package Source Mapping is enabled, but no source found under the specified package ID: microsoft.dotnet-interactive. See the documentation for Package Source Mapping at https://aka.ms/nuget-package-source-mapping for more details."

I then looked for nuget.config on my PC and when i opened it (C:\Users{myUser}\AppData\Roaming\NuGet) I noticed that my file looked like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
  <packageSourceMapping>
    <packageSource key="company-internal-packages">
        <package pattern="Polly" />
      </packageSource>
    <packageSource key="nuget.org">
      <package pattern="Microsoft.Extensions.Http.Polly" />
      <package pattern="Polly.Core" />
      <package pattern="Microsoft.Extensions.Diagnostics.Abstractions" />
      <package pattern="OpenTelemetry.Api.ProviderBuilderExtensions" />
    </packageSource>
  </packageSourceMapping>
</configuration>

I don't know exactly why the file looked like this, but after changing the contents of the nuget package source to this, the dotnet tool managed to install the tool:

<packageSource key="nuget.org">
      <package pattern="Microsoft.*" />
    </packageSource>