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.88k stars 383 forks source link

failure on macos #308

Closed moderakh closed 3 years ago

moderakh commented 4 years ago

Describe the bug

When I try to install this on macos it fails.

Did this error occur while using dotnet interactive?

Screenshots

If applicable, add screenshots to help explain your problem.

the first command works fine:

dotnet tool install -g --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json" Microsoft.dotnet-interactive

but the second one fails:

❯ dotnet interactive jupyter install
Unhandled exception: System.ComponentModel.Win32Exception (13): Permission denied
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Microsoft.DotNet.Interactive.Utility.CommandLine.StartProcess(String command, String args, DirectoryInfo workingDir, Action`1 output, Action`1 error, ValueTuple`2[] environmentVariables)
   at Microsoft.DotNet.Interactive.Utility.CommandLine.Execute(String command, String args, DirectoryInfo workingDir, Nullable`1 timeout)
   at Microsoft.DotNet.Interactive.App.JupyterKernelSpec.ExecuteCommand(String command, String args) in F:\workspace\_work\1\s\dotnet-interactive\JupyterKernelSpec.cs:line 25
   at Microsoft.DotNet.Interactive.App.JupyterInstallCommand.InvokeAsync() in F:\workspace\_work\1\s\dotnet-interactive\JupyterInstallCommand.cs:line 45
   at System.CommandLine.Invocation.CommandHandler.GetResultCodeAsync(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 where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__19_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.DotNet.Interactive.App.CommandLine.CommandLineParser.<>c__DisplayClass3_0.<<Create>b__3>d.MoveNext() in F:\workspace\_work\1\s\dotnet-interactive\CommandLine\CommandLineParser.cs:line 134
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass21_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__10_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__9_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseExceptionHandler>b__0>d.MoveNext()

Please complete the following:

I installed jupyter notebook and python using homebrew

jonsequitur commented 4 years ago

In that terminal do you have permission to write to the kernelspec location, e.g. one of the paths displayed by running jupyter kernelspec list?

moderakh commented 4 years ago

I do have permission yes, as that is a homebrew installation

jupyter kernelspec list
Available kernels:
  python3    /usr/local/share/jupyter/kernels/python3

however I tried this with sudo as well, that fails with the same message. Also one thing seems weird is System.ComponentModel.Win32Exception exception name. IMO this should be a platform independent failure. I don't have win32 on mac :-)

moderakh commented 4 years ago

any update on this?

colombod commented 4 years ago

Did you install python AND jupyter using brew? I have done both an Anaconda based setup and a pure python and pip install. All without issues. What are the access rights to the path /usr/local/share/jupyter/kernels/ ?

moderakh commented 4 years ago

I installed python3 and pip3 using homebrew. then I installed jupyter using pip3.

That path belong to current user.

ls -al /usr/local/share/jupyter/kernels/
total 0
drwxr-xr-x  3 moderakh  admin   96 Mar 20 09:39 .
drwxr-xr-x  4 moderakh  admin  128 Mar 20 09:39 ..
drwxr-xr-x  5 moderakh  admin  160 Mar 20 13:18 python3
moderakh commented 4 years ago

@colombod

moderakh commented 4 years ago

ping ... could you please provide an update?

jbaron commented 4 years ago

I installed Jupyter as a user (so not sudo pip global) and afterwards could successfully install .net interactive. The kernels are installed like this:

.net-csharp /Users/peter/Library/Jupyter/kernels/.net-csharp .net-fsharp /Users/peter/Library/Jupyter/kernels/.net-fsharp .net-powershell /Users/peter/Library/Jupyter/kernels/.net-powershell python3 /Users/peter/Library/Jupyter/kernels/python3

Perhaps something to try?

P.S What I also noticed is that after the recent updates of MacOs, it doesn't allow the /usr/local directory to be owned by a normal user (so even chown doesn't work anymore). I would guess if you tried sudo already this should not be the cause, but it is a recent change in the behaviour of MacOs that messes with many brew installations and the like.

colombod commented 4 years ago

@moderakh, we did improve the install logic, could you verify if the bug still is present?

colombod commented 3 years ago

@moderakh can we close this issue?

moderakh commented 3 years ago

I didn't try after your last comment. but I am not working on the relevant project for which I needed this (for the time being). feel free to close this. If I run into it again I will re-open or create a new one.

colombod commented 3 years ago

You are always welcome