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.9k stars 389 forks source link

Kernel immediately ends on Pop_OS #2299

Open calebjacobo opened 2 years ago

calebjacobo commented 2 years ago

I'm on Pop_OS and I cannot run .NET Interactive Notebooks. When I try to create a new notebook, the kernel will start and then immediately end.

I did a fresh install of the OS, then I installed the dotnet SDK, VS Code, and the .Net Interactive Notebook extension, and that's it. I try to create a new blank notebook and the server starts, then stops with an error. I'm pasting that console output below:

`Starting kernel for 'untitled:Untitled-1.dib?dotnet-interactive' using: dotnet tool run dotnet-interactive -- [vscode] stdio --working-dir /home/calebjacobo/Downloads Kernel for 'untitled:Untitled-1.dib?dotnet-interactive' started (10299). kernel (10299) stderr: Unhandled exception: kernel (10299) stderr: System.IO.FileNotFoundException: Could not load file or assembly 'System.Management.Automation, Version=7.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'System.Management.Automation, Version=7.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.DotNet.Interactive.PowerShell.PowerShellKernel..ctor() at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.CreateKernel(String defaultKernelName, FrontendEnvironment frontendEnvironment, StartupOptions startupOptions) in D:\a_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 466 at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>cDisplayClass5_0.d.MoveNext() in D:\a_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 311 --- End of stack trace from previous location --- at System.CommandLine.NamingConventionBinder.CommandHandler.GetExitCodeAsync(Object returnValue, InvocationContext context) at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context) at System.CommandLine.Invocation.InvocationPipeline.<>cDisplayClass4_0.d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass17_0.d.MoveNext() --- End of stack trace from previous location --- at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass5_0.<b2>d.MoveNext() in D:\a_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 162 --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass12_0.d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass19_0.d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass16_0.d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.d.MoveNext()`

Here is my SDK info:

.NET SDK (reflecting any global.json): Version: 6.0.109 Commit: 58a93139d8

Runtime Environment: OS Name: pop OS Version: 22.04 OS Platform: Linux RID: ubuntu.22.04-x64 Base Path: /usr/lib/dotnet/dotnet6-6.0.109/sdk/6.0.109/

global.json file: Not found

Host: Version: 6.0.9 Architecture: x64 Commit: 163a63591c

.NET SDKs installed: 6.0.109 [/usr/lib/dotnet/dotnet6-6.0.109/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.9 [/usr/lib/dotnet/dotnet6-6.0.109/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.9 [/usr/lib/dotnet/dotnet6-6.0.109/shared/Microsoft.NETCore.App]

Download .NET: https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs: https://aka.ms/dotnet/runtimes-sdk-info

VS Code info:

Version: 1.71.2 Commit: 74b1f979648cc44d385a2286793c226e611f59e7 Date: 2022-09-14T21:12:14.256Z Electron: 19.0.12 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Linux x64 5.18.10-76051810-generic Sandboxed: No

Extension info:

Name: .NET Interactive Notebooks Id: ms-dotnettools.dotnet-interactive-vscode Description: .NET Interactive Notebooks for VS Code. Git SHA https://github.com/dotnet/interactive/commit/ff15cb3ae196f03a73d8e158908371b561058c3f Version: 1.0.3452020 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode

calebjacobo commented 2 years ago

Is this a permissions thing? I tried the same thing on my MacBook and when I created the notebook, it asked me for permission to access the downloads folder. Is this simply a matter of granting the right permissions, and if so, how?

jonsequitur commented 2 years ago

I don't know. That's possible.

Another possibility is that the TFM isn't supported by the System.Management.Automation (aka PowerShell) package. If you create a simple console app referencing this package, instantiate some type from it, and build and run it, do you see a similar error?

calebjacobo commented 2 years ago

@jonsequitur sorry, I’m unsure how to do this.

calebjacobo commented 2 years ago

@jonsequitur

Ok, I made a simple console app, then tried to print out something from System.Management.Automation and I got the same kind of error:

`Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'System.Management.Automation, Version=7.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'System.Management.Automation, Version=7.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'`

So it seems like your assumption could be correct. What is the TFM?

jonsequitur commented 2 years ago

TFM is the target framework moniker. Assemblies are often found inside TFM-specific subfolders in a NuGet package and I'm guessing from the outcome of your experiment that on Pop_OS it's looking for a TFM-specific subfolder which doesn't exist. (The only one I see is net6.0)

image

@daxian-dbw Any insights here?

daxian-dbw commented 2 years ago

No, no idea what was happening. The 7.2.6 version of PowerShell SDK targets net6.0, and dotnet-interactive should've bundled everything already.

absolutejam commented 2 years ago

I'm also experiencing this on Pop!_OS

VS code ext version: v1.0.3519061

dotnet sdk check
.NET SDKs:
Version      Status
------------------------
6.0.110      Up to date.

Try out the newest .NET SDK features with .NET 7.0.100-rc.2.22477.23.

.NET Runtimes:
Name                          Version      Status
------------------------------------------------------
Microsoft.AspNetCore.App      6.0.10       Up to date.
Microsoft.NETCore.App         6.0.10       Up to date.

dotnet-interactive version: 1.0.350406+612aa40cba7d6a1f734272f71657a65561394752


I tried to see if I could capture where it's looking (when running dotnet-interactive stdio for example) as the exception message doesn't provide much more detail.

inotifywatch -r /home/sadbooth/.nuget
Establishing watches...
Finished establishing watches, now collecting statistics.
total  access  close_nowrite  open  filename
4      2       1              1     /home/sadbooth/.nuget/packages/system.management.automation/7.2.7/runtimes/
4      2       1              1     /home/sadbooth/.nuget/packages/system.management.automation/7.2.7/

Not very useful :shrug:

Here's the file tree for that path:

/home/sadbooth/.nuget/packages/system.management.automation
└── 7.2.7
    ├── _manifest
    │   └── spdx_2.2
    │       ├── manifest.spdx.json
    │       └── manifest.spdx.json.sha256
    ├── Powershell_black_64.png
    ├── ref
    │   └── net6.0
    │       ├── System.Management.Automation.dll
    │       └── System.Management.Automation.xml
    ├── runtimes
    │   ├── unix
    │   │   └── lib
    │   │       └── net6.0
    │   │           └── System.Management.Automation.dll
    │   └── win
    │       └── lib
    │           └── net6.0
    │               └── System.Management.Automation.dll
    ├── system.management.automation.7.2.7.nupkg
    ├── system.management.automation.7.2.7.nupkg.sha512
    └── system.management.automation.nuspec

12 directories, 10 files

Then I tried running the same command with strace - log

briangardner commented 1 year ago

I'm also seeing this on PopOS when trying to use dotnet interactive or the Polyglot Notebooks plugin in VS Code.

dotnet info:

➜ dotnet --info
.NET SDK:
 Version:   7.0.107
 Commit:    bf72c06963

Runtime Environment:
 OS Name:     pop
 OS Version:  22.04
 OS Platform: Linux
 RID:         ubuntu.22.04-x64
 Base Path:   /usr/lib/dotnet/sdk/7.0.107/

Host:
  Version:      7.0.7
  Architecture: x64
  Commit:       5b20af47d9

.NET SDKs installed:
  7.0.107 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.7 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.7 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Error:

➜ dotnet interactive stdio
Unhandled exception: System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.Interactive.PowerShell.PowerShellKernel' threw an exception.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Management.Automation, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'System.Management.Automation, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   --- End of inner exception stack trace ---
   at Microsoft.DotNet.Interactive.PowerShell.PowerShellKernel..ctor() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.PowerShell\PowerShellKernel.cs:line 84
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.CreateKernel(String defaultKernelName, FrontendEnvironment frontendEnvironment, StartupOptions startupOptions, TelemetrySender telemetrySender) in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 489
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass5_0.<<Create>b__21>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 333
--- End of stack trace from previous location ---
   at System.CommandLine.NamingConventionBinder.CommandHandler.GetExitCodeAsync(Object returnValue, InvocationContext context)
   at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass5_0.<<Create>b__2>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 161
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
obratim commented 4 months ago

getting same issue in Calculate Linux, a distributive based on Gentoo

dotnet can be installed here by two packages:

The issue is reproducable only with package dev-dotnet/dotnet-sdk, e.g. building dotnet from sources

$ dotnet --info
.NET SDK:
 Version:           8.0.105
 Commit:            eae90abaaf
 Workload version:  8.0.100-manifests.796a77f8

Runtime Environment:
 OS Name:     calculate
 OS Version:  
 OS Platform: Linux
 RID:         calculate-x64
 Base Path:   /usr/lib64/dotnet-sdk-8.0/sdk/8.0.105/

.NET workloads installed:
 Workload version: 8.0.100-manifests.796a77f8
There are no installed workloads to display.

Host:
  Version:      8.0.5
  Architecture: x64
  Commit:       087e15321b

.NET SDKs installed:
  8.0.105 [/usr/lib64/dotnet-sdk-8.0/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.5 [/usr/lib64/dotnet-sdk-8.0/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.5 [/usr/lib64/dotnet-sdk-8.0/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/lib64/dotnet-sdk-8.0]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Error:

$ dotnet interactive stdio
Unhandled exception: System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.Interactive.PowerShell.PowerShellKernel' threw an exception.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Management.Automation, Version=7.4.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'System.Management.Automation, Version=7.4.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   --- End of inner exception stack trace ---
   at Microsoft.DotNet.Interactive.PowerShell.PowerShellKernel..ctor() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.PowerShell\PowerShellKernel.cs:line 85
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.CreateKernel(String defaultKernelName, FrontendEnvironment frontendEnvironment, StartupOptions startupOptions, TelemetrySender telemetrySender) in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 488
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass5_0.<<Create>b__20>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 333
--- End of stack trace from previous location ---
   at System.CommandLine.NamingConventionBinder.CommandHandler.GetExitCodeAsync(Object returnValue, InvocationContext context)
   at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass5_0.<<Create>b__2>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 161
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
obratim commented 3 months ago

It is an issue in Microsoft.PowerShell.SDK package.

System.Management.Automation is stored in same git repository and is referenced as project, not as a package. As the result in the nuspec file written that it depends on a one version of System.Management.Automation, but inside nupkg archive under ref/net8.0/ there is another version of System.Management.Automation.dll.

This confusion causes error.

Reported a bug: https://github.com/PowerShell/PowerShell/issues/24110