Announcing .NET Interactive - Try .NET includes .NET Notebooks and more
At Microsoft Ignite 2019, we were happy to announce that the "Try .NET global tool" added support for C# and F# Jupyter notebooks. Last week, the same team that brought you .NET Notebooks announced Preview 2 of the .NET Notebook.
Name Change - .NET interactive
As the scenarios for what was "Try .NET" continued to grow, the team wanted to a name that encompassed all the experiences they have as well as all the experiences they will have in the future. What was the Try .NET family of projects is now .NET interactive.
The F# community has enjoyed F# in Juypter Notebooks from years with the pioneering functional work of Rick Minerich, Colin Gravill and many other contributors! .NET Interactive is a family of tools and kernels that offer support across a variety of experiences as a 1st party Microsoft-supported offering.
.NET interactive is a group of CLI (command line interface) tools and APIs that enable users to create interactive experiences across the web, markdown, and notebooks.
.NET Interactive APIs and Tools
Here is what the command line looks like using the dotnet CLI.
dotnet interactive
global tool:- Used for notebooks (Jupyter and nteract). This came out in late 2019.
dotnet try
global tool:- Used for workshops and offline documentation. Interactive markdown with a backing project. I wrote about this in May 2019.
trydotnet.js
API- Currently, only used internally at Microsoft, this API is used on the .NET page and C# documentation. Maybe one day I can use it on my blog? And yours?
Installing .NET Interactive
You can start playing with it today, locally or in the cloud! Seriously. Just click and start using it.
Before you install the .NET interactive global tool, please make sure you have the following:
- .NET Core 3.1 SDK
- Jupyter : JupyterLab can be installed using Anaconda or
conda
orpip
.- For more details on how to do this please checkout the offical Jupyter installation guide.
- Open Anaconda Prompt (windows) or Terminal (macOS).
- Verify that Jupyter ins installed and present on the current path.
> jupyter kernelspec list python3 ~\jupyter\kernels\python3
- Open Windows terminal and install the dotnet interactive global tool:
> dotnet tool install --global Microsoft.dotnet-interactive
- Switch back to Anaconda prompt and install the .NET kernel. To be clear, here we are using the dotnet CLI to let the Jupyter CLI know that we exist!
> 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
- While still in Anaconda prompt, verify that .NET kernel is installed like this
> 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
Now you can just run "jupyter lab
" at the command line and you're ready to go!
More Languages - PowerShell
The .NET kernel now comes PowerShell support too! In Preview 2, the .NET interactive team partnered with PowerShell to enable this scenario. You can read more about the announcement of the PowerShell blog.
The .NET interactive team is looking forward to hearing your thoughts. You can talk to them at https://github.com/dotnet/interactive
Multi .NET language Notebooks
I wanted to highlight one of the hidden gems .NET interactive has had since Preview 1 - multi-language notebooks. That means that users can switch languages in a single notebook. Here is an example of a C#, F#, and PowerShell in a single .ipynb file.
Using one of the language magic commands (#!csharp
, #!fsharp
,#pwsh
) tells the .NET Interactive kernel to run the cell in a specific language. To see a complete list of the available magic commands, enter the #!lsmagic
command into a new cell and run it.
.NET Code in nteract.io
Additionally, you can now write .NET Code in nteract.io. 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.
Learn More
- 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
The team is looking forward to seeing what you build. Moving forward, the team has 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.
Sponsor: Have you tried developing in Rider yet? This fast and feature-rich cross-platform IDE improves your code for .NET, ASP.NET, .NET Core, Xamarin, and Unity applications on Windows, Mac, and Linux.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
I had gotten started recently on Jupyter and it was my first time installing Python on my Mac and things got squirrelly when I tried installing pip (I think that's where things went wrong), so at some point I ended up involving Homebrew either to get pip installed or Jupyter installed, but since that time, I have been able to run the jupyter command but I have been nervous that I did not install this the proper way. I'm very excited to get moving with this article, as I've been a little confused on getting started after running "jupyter notebook" in terminal.
However, before I move any further, I was wondering if you could tell me if I should try to redo my python-pip-jupyter setup. Here's what I currently get when I run "jupyter kernelspec list":
Available kernels:
python3 /usr/local/Cellar/jupyterlab/1.2.4/libexec/lib/python3.7/site-packages/ipykernel/resources
Think I'm safe to proceed or should I try and untangle my mess first?
Mike
"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:"
dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.110520
First is that the icons for Python, .NET and PowerShell were not visible. The launcher looked broken but I thought that this could be a problem of a different port and hostname. For example the notebook having urls to localhost which won't resolve.
Second is that the kernels wouldn't start. I even tried this without the .net and powershell kernels configured. Just Python and Jupyter.
These are my individual commands
sudo apt-get update
sudo apt-get -y install aspnetcore-runtime-3.1
sudo pip install --upgrade pip
sudo pip install jupyterlab
sudo pip install notebook
sudo dotnet tool install --global Microsoft.dotnet-interactive
export PATH="$PATH:/home/vsonline/.dotnet/tools"
export DOTNET_ROOT="$(dirname $(which dotnet))"
Excluding the dotnet relevant lines installs and configures the notebooks for Python.
This is one of the best article i am reading right now. great work and really informative and helpful me to
I would love to know what you think about the Nethereum playground. http://playground.nethereum.com Similar idea but targeted to a specific set of libraries and Blazor / Wasm
out loads. I am just hoping to contribute & aid different users like its aided me.
Great job.
I too am an aspiring blog blogger but I'm still unfamiliar with the whole thing.
Do you have any suggestions for first-time blog writers?
I'd certainly appreciate it.
Comments are closed.