Since .NET Try supports F# officially I wanted to switch over my Jupyter notebook instance to use that instead of IFsharp. But I ran into a couple of frustrating issues that I wanted to document in case anyone else hit them and didn't know how to debug the issue.
Issue 1. dotnet-try installs but isn't usable
I followed Scott Hanselman's instructions to install dotnet-try, but when I tried to execute dotnet try jupyter install it seemed as though dotnet-try wasn't installed at all:
$ dotnet tool install dotnet-try --global
You can invoke the tool using the following command: dotnet-try
Tool 'dotnet-try' (version '1.0.19553.4') was successfully installed.
$ dotnet try jupyter install Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET Core program, but dotnet-try does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
After a lot of head scratching I dug into the actual docs and learned that both .NET Core 3.0 and .NET Core 2.1 SDKs should be installed, while I only had .NET Core 3.1's SDK So after a quick sudo apt install dotnet-sdk-3.0 dotnet-sdk-2.1 I was successfully able to install the kernel and list it:
$ jupyter kernelspec list Available kernels: .net-csharp /home/notebook/.local/share/jupyter/kernels/.net-csharp .net-fsharp /home/notebook/.local/share/jupyter/kernels/.net-fsharp mit-scheme /usr/local/share/jupyter/kernels/mit-scheme python3 /usr/local/share/jupyter/kernels/python3
Issue 2. Jupyter can't run dotnet-try
However even though it was installed, each time I tried to create a new F# notebook Jupyter would give an error saying that it was unable to connect to the kernel. After taking a quick look at my logs I saw the same error as before!
Feb 09 13:19:11 aviemore jupyter[837]: [I 13:19:11.169 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports Feb 09 13:19:11 aviemore jupyter[837]: Could not execute because the specified command or file was not found. Feb 09 13:19:11 aviemore jupyter[837]: Possible reasons for this include: Feb 09 13:19:11 aviemore jupyter[837]: * You misspelled a built-in dotnet command. Feb 09 13:19:11 aviemore jupyter[837]: * You intended to execute a .NET Core program, but dotnet-try does not exist. Feb 09 13:19:11 aviemore jupyter[837]: * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. Feb 09 13:19:14 aviemore jupyter[837]: [I 13:19:14.180 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports Feb 09 13:19:14 aviemore jupyter[837]: Could not execute because the specified command or file was not found. Feb 09 13:19:14 aviemore jupyter[837]: Possible reasons for this include: Feb 09 13:19:14 aviemore jupyter[837]: * You misspelled a built-in dotnet command. Feb 09 13:19:14 aviemore jupyter[837]: * You intended to execute a .NET Core program, but dotnet-try does not exist. Feb 09 13:19:14 aviemore jupyter[837]: * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
EnvironmentFile=/home/jupyter/config/notebook-config