Today I was writing an example PowerShell script in Jupyter Notebook that used a module that required PowerShell 7.1.x. It wasn’t working and was complaining about not meeting the minimum requirements. I checked to see what the current version of PowerShell was in my .NET Interactive environment (required for PowerShell in Jupyter) and was indeed not at the minimum required for the module. It was PowerShell 7.0.3.
When attempting to update .NET Interactive which I figured would be required to get the latest version of PowerShell, I was returned the error Microsoft.dotnet-interactive is not compatible with netcoreapp3.1.
This posts details getting my environment updated to allow me to run PowerShell 7.1.x in Jupyter Notebook.
Error – Microsoft.dotnet-interactive is not compatible with netcoreapp3.1
Error message Microsoft.dotnet-interactive is not compatible with netcoreapp3.1 is returned when using dotnet tool to update Microsoft.dotnet-interactive.
dotnet tool update -g Microsoft.dotnet-interactive
Inspecting .NET SDK Versions
It was time to have a look at the versions of the .NET SDK’s I had installed in my environment. Running dotnet –info showed that I had versions 2.2.x, 3.1.201 and 3.1.301.
The error above did state that net5.0 (.NETCoreApp,Version=5.0) was required for the latest (1.0.221505) version of Microsoft.dotnet-interactive. That is because PowerShell 7.1 is built upon .NET 5.
Updating .NET SDK / Installing .NET 5 SDK
I headed over to dotnet.microsoft.com and downloaded the x64 bit version of the .NET SDK 5.0.
And I installed the .NET 5 SDK.
After installation I checked the versions installed again using dotnet –info. It showed that I now had version 5.0.202 in addition to the versions I previously had.
Updating Microsoft.dotnet-interactive for PowerShell 7.1.x
Re-running the update for .NET Interactive this time was successful. No more Microsoft.dotnet-interactive is not compatible with netcoreapp3.1 error message.
dotnet tool update -g Microsoft.dotnet-interactive
PowerShell 7.1.x in Jupyter Notebook
Going back and starting Jupyter Notebook and checking the version of PowerShell I could see that it was now up to date with PowerShell 7.1.3.
Summary
If you have been running Jupyter Notebook for some time and have being using PowerShell 6.x or 7.0.x you will need to install the .NET 5.0 SDK and update .NET Interactive to the latest release and then PowerShell 7.1.x will be available.