.NET Interactive is here! | .NET Notebooks Preview 2
In November 2019, we announced .NET support for Jupyter notebooks with both C# and F# support. Today we are excited to announce Preview 2 of the .NET Notebook experience.
New Name – Meet .NET interactive
As our scenarios grew in Try .NET, we wanted a new name that encompassed all our new experiences from the runnable snippets on the web powered by Blazor (as seen on the .NET page) , to interactive documentation for .NET Core with the dotnet try global tool, to .NET Notebooks.
Today we are announcing our official name change to .NET interactive.
.NET interactive is a group of CLI tools and APIs that enable users to create interactive experiences across the web, markdown, and notebooks.
.NET Interactive Breakdown
dotnet interactiveglobal tool : For .NET Notebooks (Jupyter and nteract)
dotnet tryglobal tool : For Workshops and offline docs. Interactive markdown with a backing project.
trydotnet.jsAPI (not publicly available yet): Online documentation. For example, on docs and .NET page. Currently, only used internally at Microsoft.
New Repo – dotnet/interactive
Moving forward, we have decided to split
dotnet try and
dotnet interactive tools into separate repos.
- For any issues, feature requests, and contributions to .NET Notebooks, please visit the .NET Interactive repo.
- For any issues, feature requests, and contributions on interactive markdown and trydotnet.js, please visit the Try .NET repo.
New Global Tool –
How Install .NET Interactive
First, make sure you have the following installed:
- The .NET 3.1 SDK.
Jupyter. Jupyter can be installed using Anaconda.
Open the Anaconda Prompt (Windows) or Terminal (macOS) and verify that Jupyter is installed and present on the path:
> jupyter kernelspec list python3 ~\jupyter\kernels\python3
- Next, in an ordinary console, install the
dotnet interactiveglobal tool:
> dotnet tool install --global Microsoft.dotnet-interactive
- Install the .NET kernel by running the following within your Anaconda Prompt:
> dotnet interactive jupyter install [InstallKernelSpec] Installed kernelspec .net-csharp in ~\jupyter\kernels\.net-csharp .NET kernel installation succeeded [InstallKernelSpec] Installed kernelspec .net-fsharp in ~\jupyter\kernels\.net-fsharp .NET kernel installation succeeded [InstallKernelSpec] Installed kernelspec .net-powershell in ~\jupyter\kernels\.net-powershell .NET kernel installation succeeded
- You can verify the installation by running the following again in the Anaconda Prompt:
> jupyter kernelspec list .net-csharp ~\jupyter\kernels\.net-csharp .net-fsharp ~\jupyter\kernels\.net-fsharp .net-powershell ~\jupyter\kernels\.net-powershell python3 ~\jupyter\kernels\python3
Please Note: If you are looking for
dotnet try experience please visit dotnet/try.
New language support – PowerShell
PowerShell notebooks combine the management capabilities of PowerShell with the rich visual experience of notebooks. The integration of PowerShell’s executable experience with rich text and visualization open up scenarios for PowerShell users to integrate and amplify their teaching, and support documents. As an example, this demo of a new PowerShell feature was easily transformed into a shareable, interactive teaching tool.
With the multi-kernel experience provided by the .NET interactive kernel a single notebook, now with PowerShell support, can efficiently target both the management plane and the data plane.
DBAs, sysadmins, and support engineers alike have found PowerShell notebooks useful for resource manipulation and management. For example, this notebook teachers the user how to create an Azure VM from PowerShell.
We look forward to seeing what our customers to do with this experience. Read the PowerShell blog post for more information.
Run .NET Code in nteract.io
In addition to writing .NET Code in Jupyter Notebooks, users can now write their code in nteract. nteract is an open-source organization that builds SDKs, applications, and libraries that helps people make the most of interactive notebooks and REPLs. We are excited to have our .NET users take advantage of the rich REPL experience nteract provides,including the nteract desktop app.
To get started with .NET Interactive in nteract please download the nteract desktop app and install the .NET kernels.
- Try sample .NET notebooks online using Binder. This also allows you try out .NET Interactive daily builds.
- Create and run .NET notebooks on your machine.
- Share your own .NET notebooks with others online using Binder.
- .NET Interactive with nteract
Our team can’t wait to see what you do with .NET Interactive. Please check out our repo to learn more and let us know what you build.
Happy interactive programming !
The name “.NET Interactive” is confusing since it clashes with your C# REPL, “C# Interactive” and the two tools are similar but at the same time very different.
Separately, I get the Jupyter notebooks are cool and make great demos, but do they have any other use cases outside of data science? They’ve been around for years now and I’ve yet to see someone use one in the actual real world. The vast majority of developers would benefit a lot more from you guys investing in C# Interactive again, integrating it with the debugger, increasing its prominence in Visual Studio, and making it easier to use and more powerful (charting, tables).
While we absolutely use notebooks for datascience experiments (we actually find the blend of documentation, code and visualisation really help working with business stakeholders), I particularly love using notebooks for doing performance benchmark experiments using tools like BenchmarkDotNet.
this comment has been deleted.
I have to agree with @MgSam regarding C# Interactive. I believed C# Interactive was one of the best things that was produced from Roslyn and it appears to be very lacking in support for the past years now. The are many features (debugging, NuGet, etc.) needed to be added to C# Interactive and I, along with many others, have posted (GitHub, VS, blogs, etc.) pleading to provide a possible roadmap for C# Interactive. If this new .NET Interactive is the future of .NET REPL, please be open/clear with what is expected. Thx
Under the hood, .NET Interactive uses the same bits as Visual Studio’s C# Interactive and F# Interactive windows, meaning Roslyn scripting and FSI. We’re making improvements to those tools as part of this project too.
Agreed. We already have C# interactive and F# interactive so this is rather confusing.
Just learned that another .NET exists
How many .NET you are going to create?
You are doing it all wrong. There should be just one VS Studio, one .NET one code
Simply you should work only on compilers to that one solution
Developer then just could use Build As (need to be implemented) command to build one code to Windows or Mac
or Android or whatever else using specific compiler
Microsoft is currently working towards .NET 5.
In their old .NET, they apparently have a million #if statements all over the place, and then scripts build the various flavors by having the right set of defines. Even, apparently, Silverlight. That’s based on what they’ve said in posts here and over on Hanselman’s blog.
And so basically – .NET Core they went through and took all the #if’s out. And so you have this new Common Language Runtime / Microsoft Intermediate Language interpreter that has as few built-in dependencies as possible, and that’s .NET Core runtime itself. And then you have a cloud of libraries in what would have been the Basic/Base Class Library (BCL) before – and those are now mostly NuGet packages – and so you can pick versions of them when you compile, and those versions are bundled with your executable, and no other process can cause a different version to load.
One of the side effects is the individual project teams that are working on GitHub, which is most of them on the .NET side, can now take pull requests and feature input / issues directly through GitHub, and so you can go over there and beg them directly and make the case directly for specific features in specific libraries, instead of having to go through support and hoping you get the single support rep who has actually written code professionally at some point in their life. 😉
Visual Studio supports multiple targets in a single project file, and that is the traditional C++ way to build C code for multiple platforms in Visual Studio. You can add a MacOS target right now, and changing the target is then the pulldown next to “Release” and “Debug” on the default toolbars. That’s explicitly what that feature is intended for. You can do more on the C++ side than on the C# side right now.
However, if you’re not calling any OS-specific functionality – the .NET Core app you compile runs, from a single build, on Windows, Linux and MacOS. Same binary file works on all three. You can even use WinForms or WPF, and those work as expected now mostly. (there are differences, and third party components generally need to be designed for the new ones)
Just to clarify: what is announced in this blog post is not another flavor of .NET. This is about bringing .NET to the Jupyter Notebooks ecosystem and enhancing interactive programming with C# and F#. It’s the same compilers, runtime, etc. under the hood as any normal .NET Core application.
When trying to run following in Windows 10 cmd
The tool package could not be restored.
Tool ‘microsoft.dotnet-interactive’ failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the –version option to specify the version.
In the blog post I didn’t specify the package version just to make sure that the post stays fresh. Please use this command as seen on nuget
Thanks Maria, that installed correctly now. The next issue I’am having is:
(base) C:\Users\roman.cerny>jupyter kernelspec list
python3 C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\share\jupyter\kernels\python3
(base) C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\share>dotnet interactive jupyter install
.NET kernel installation failed with error: Could not find jupyter kernelspec module
The same happens even after restarting my PC
Hi Roman, May I ask you a quick question – When you installed the .NET kernel(
) did you do it in Anaconda prompt? If you don’t mind could you please open an issue here ? I would really like to help you troubleshoot this. Thank you
Hi Maria, I have now created new issue https://github.com/dotnet/interactive/issues/157#issue-563062412
Thank you for your help.
Considering this great progress, can we expect to get the PowerShell kernel in Azure Notebooks at all? Thanks!
Really excited about .net in Jupyter moving forward. I was using Python/Jupyter to explore data and prototype solutions but this is looking like my new go to. Preview 1 had some bugs with syntax highlighting and such but was still useful. I am hoping VS Code will pick up support for .net core in Jupyter soon.
It’s delightful to be able to install a Jupyter version on Windows that actually works reliably. How do I go about upgrading to JupyterLab?
Glad you like it! First you will need to install Jupyter Lab either conda or pip. Here are the install instructions (https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html). Once you have that installed go to Anaconda prompt type in the following command
. This will launch JupyterLab.
Awesome! Big fan of Notebooks!
… But why were F# and PowerShell supported before Visual Basic .Net?
The later is more popular than the former two together.
How misleading it is to name it .Net Interactive and support PowerShell but not Visual Basic .Net …
I, for one, will not use this until you include support for Visual Basic .Net.
I’m on my way to learning Python and will switch to it if Microsoft continues to alienate the large VB.Net community.
We hear you. C# and F# have a big head start here because they both have interactive language variants. If the VB.NET interactive language variant had been available, we’d have been happy to include it.
I absolutely love the work that’s being done here, thanks to the Interactive team for making this a reality.
I also love the new Jupyter support (currently in the Python extension for) VS Code.
It would be wonderful to have Interactive work with Jupyter in VS Code.
I posted this request on the Interactive and vscode-python GitHub sites but wanted to share my request here as well. There seems to be an intent to make this happen, one way or another, which is great. (Though, I might have poked a wasps nest with my questions. :)
VS Code with Jupyter .NET Interactive is a must-have feature. Please make it available ASAP :). Thanks a lot.
Keep an eye on our PRs: https://github.com/dotnet/interactive/pull/412
In lieu of an emoji for back-flip somersaults, YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!
This technology is what I’ve wanted for so long.