interactive icon indicating copy to clipboard operation
interactive copied to clipboard

System.Management.Automation not found

Open Yucked opened this issue 3 years ago • 7 comments

Describe the bug

Setting up a docker container from scratch using alpine image. Everything builds as shown in the screenshot but whenever I create a new C#/PS notebook, it begins throwing exceptions and whatever is entered in the notebook and ran hangs forever.

File name: 'System.Management.Automation, Version=7.2.0.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 588
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass5_0.<<Create>g__JupyterHandler|11>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 272
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.CommandHandler.GetExitCodeAsync(Object value, InvocationContext context)
   at System.CommandLine.Invocation.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__DisplayClass23_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__3>d.MoveNext() in D:\a\_work\1\s\src\dotnet-interactive\CommandLine\CommandLineParser.cs:line 218
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<<UseVersionOption>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__24_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseDebugDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()
[I 2021-11-24 22:54:42.749 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), new random ports

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

.NET 6 SDK and Runtime is installed. PWSH 7.2.0 is also installed. Both are in path as well.

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ): The preview version (1.0.257301) since the one on nuget requires .net 5.

RUN dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-interactive && \
    dotnet interactive jupyter install && \
    mkdir ${NOTEBOOKS_DIR} && \
    ln -s ${PS_LOC}/pwsh /usr/bin/pwsh && \
    ln -s ${DOTNET_ROOT}/dotnet /usr/bin/dotnet
  • OS
    • [ ] Windows 11
    • [ ] Windows 10
    • [ ] macOS
    • [x] Linux (Please specify distro) Alpine:edge
    • [ ] iOS
    • [ ] Android
  • Browser
    • [ ] Chrome
    • [x] Edge
    • [ ] Firefox
    • [ ] Safari
  • Frontend
    • [ ] Jupyter Notebook
    • [x] Jupyter Lab
    • [x] nteract
    • [ ] Visual Studio Code
    • [ ] Visual Studio Code Insiders
    • [ ] Visual Studio
    • [ ] Other (please specify)

Screenshots

If applicable, add screenshots to help explain your problem. image image image

Yucked avatar Nov 24 '21 23:11 Yucked

Have the same issue on arch linux with .NET 6 (6.0.100) and aspnet-runtime 6.0.0 'microsoft.dotnet-interactive' (version '1.0.257301')

m0rphed avatar Nov 25 '21 15:11 m0rphed

Same issue for me in EndeavourOS, tried installing powershell (because apparently System.Management.Automation is part of it) and still didn't work.

Hairo avatar Dec 15 '21 15:12 Hairo

I am also seeing this issue in AlamaLinux 8 with dotnet-interactive version 1.0.260601+9d1ecd3c06ba93e59bfef3842d2660c08d9e2ce5. I have ensured that powershell 7.2.0 is installed and launches successfully. I am seeing this error both when trying to use botnet-interactive with a jupyter notebook as well as just launching dotnet-interactive stdio

One thing I noticed is that the error being thrown is for System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 while the only available 7.2.0 PowerShell package from the Microsoft repository includes System.Management.Automation, Version=7.2.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35 I don't know if it is possible to get the 7.2.0.0 DLL from somewhere or if that might be the issue.

ssteck avatar Jan 12 '22 18:01 ssteck

Same problem on Arch Are there any updates on this?

maurictg avatar Mar 18 '22 20:03 maurictg

For Arch user, use the sdk build from AUR, it's newer than the community version. I don't know why but this do the trick.

tulx17 avatar Aug 03 '22 14:08 tulx17

I had the same error:

Failed to start the Kernel.

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

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

Thanks for the tip @tunbk1002. I was finally able to fix this on Manjaro. I downloaded these from the AUR:

aur/dotnet-host-bin                 6.0.3.sdk201-1         6.0.4.sdk202-1
aur/dotnet-runtime-bin              6.0.3.sdk201-1         6.0.4.sdk202-1
aur/netstandard-targeting-pack-bin  6.0.3.sdk201-1         6.0.4.sdk202-1
aur/dotnet-targeting-pack-bin       6.0.3.sdk201-1         6.0.4.sdk202-1
aur/dotnet-sdk-bin                  6.0.3.sdk201-1         6.0.4.sdk202-1 

rayhernandez avatar Oct 12 '22 07:10 rayhernandez