.NET Core with Jupyter Notebooks – Available today | Preview 1

Maria Naggaga

Please Note: The instructions in this post are obsolete. For the latest instructions please visit the .NET Interactive repo. For more information please look at our Preview 2 announcement for more information.

When you think about Jupyter Notebooks, you probably think about writing your code in Python, R, Julia, or Scala and not .NET. Today we are excited to announce you can write .NET code in Jupyter Notebooks.

Try .NET has grown to support more interactive experiences across the web with runnable code snippets, interactive documentation generator for .NET core with dotnet try global tool, and now .NET in Jupyter Notebooks.

Build .NET Jupyter Notebooks

To get started with .NET Notebooks, you will need the following:

> jupyter kernelspec list
  python3        ~\jupyter\kernels\python3
  • Next, in an ordinary console, install the dotnet interactive global tool:
> dotnet tool install -g dotnet-try
  • Install the .NET kernel by running the following within Anaconda Prompt:
> dotnet try 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
  • 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
  python3        ~\jupyter\kernels\python3


The initial set of features we released needed to be relevant to developers, with Notebook experience as well as give users new to the experience a useful set of tools they would be eager to try. Let’s have a look at some of the features we have enabled.

The first thing you will need to be aware of is when writing C# or F# in a .NET Notebook, you will be using C# Scripting or F# interactive.

You can either explore the features listed below locally on your machine or online using the dotnet/interactive binder image.

For the online documentation, please go to the Docs subfolder located in C# or F# folders.

List of features

Display output : There are several ways to display output in notebooks. You can use any of the methods demonstrated in the image below.

Object formatters : By default, the .NET notebook experience enables users to display useful information about an object in table format.

HTML output : By default .NET notebooks ship with several helper methods for writing HTML. From basic helpers that enable users to write out a string as HTML or output Javascript to more complex HTML with PocketView.

Importing packages : You can load NuGet packages using the following syntax:

#r "nuget:<package name>,<package version>"

For Example

# r "nuget:Octokit, 0.32.0"
# r "nuget:NodaTime, 2.4.6"
using Octokit; using NodaTime; 
using NodaTime.Extensions; 
using XPlot.Plotly; 

Charts with XPlot

Charts are rendered using Xplot.Plotly. As soon as users import XPlot.Plotly namespace into their notebooks(using Xplot.Ploty;), they can begin creating rich data visualizations in .NET.

Please check the .NET Notebook online for more documentation and samples.

.NET Notebooks perfect for ML .NET and .NET for Apache® Spark™

.NET notebooks bring iterative, interactive experiences popular in the worlds of machine learning and big data to .NET.


ML.NET with Jupyter Notebooks

.NET notebooks open up several compelling scenarios for ML.NET, like exploring and documenting model training experiments, data distribution exploration, data cleaning, plotting data charts, and learning.

For more details on how you can leverage ML.NET in Jupyter notebooks, check out this blog post on Using ML.NET in Jupyter notebooks. The ML.NET team has put together several online samples for you to get started with.

.NET for Apache® Spark™

Big Data for .NET

Having notebooks support is indispensable when you are dealing with Big data use cases. Notebooks allow data scientists, machine learning engineers, analysts, and anyone else interested in big data to prototype, run, and analyze queries rapidly.

So how can .NET developers and major .NET shops keep up with our data-oriented future? The answer is .NET for Apache Spark, which you can now use from within notebooks!

Today, .NET developers have two options for running .NET for Apache Spark queries in notebooks: Azure Synapse Analytics Notebooks and Azure HDInsight Spark + Jupyter Notebooks. Both experiences allow you to write and run quick ad-hoc queries in addition to developing complete, end-to-end big data scenarios, such as reading in data, transforming it, and visualizing it.

Option 1: Azure Synapse Analytics ships with out-of-the-box .NET support for Apache Spark (C#).

Option 2: Checkout the guide on the .NET for Apache Spark GitHub repo to learn how to get started with .NET for Apache Spark in HDInsight + Jupyter notebooks. The experience will look like the image below.

Get Started with the .NET Jupyter Notebooks Today!

.NET kernel brings interactive developer experiences of Jupyter Notebooks to the .NET ecosystem. We hope you have fun creating .NET notebooks. Please checkout our repo to learn more and let us know what you build.


Discussion is closed. Login to edit/delete existing comments.

  • Golois MoueletMicrosoft employee 0

    That’s a great news!!!

  • David Cuccia 0

    Wonderful! Can’t wait to give it a try!

  • Shane Milton 0

    Can this be done with Azure Notebooks?

    • Maria NaggagaMicrosoft employee 0

      We are working with the Azure Notebooks team on this. We hope to have the .NET experience in the near future. You can check out our repo to see how you can get started on your machine and how you can share your notebook using mybinder

      • Wil Wilder Apaza Bustamante 0

        this comment has been deleted.

      • Ed Kennedy 0

        Hi Maria,

        Any time frame for getting this into azure notebooks. It would be so slick!! Especially F#.


        • Abin 0

          Any update on timeframe for c# support?

  • Anil Kumar 0

    Thank you :).
    Now I can learn (or REPL) new C# features in Jupyter like I learn new Python features.

  • Radu Popa 0

    Congratulations on this effort!

    Looking forward to use VB.Net in these Jupiter Notebooks, the only Microsoft language that has a chance to compete with Python.
    I do hope you will not leave this highly popular .Net language behind.

  • Reilly Wood 0

    Very nice. Will this be coming to Azure Data Studio eventually?

    • Maria NaggagaMicrosoft employee 0

      This is a scenario we are working on internally. We will be collaborating with teams across Microsoft to light the .NET Kernel is more Azure Data solutions.

  • Jose Diego Menendez del Cueto 0

    What about Intellisense?

    • Neil MacMullen 0

      Seconded – it’s a pretty painful experience without it. Line numbers in the code box would help a lot as well when it comes to identifying errors. I suspect I’m going to be keeping VS open for code development then pasting it back into Jupyter for display of results. Nevertheless I love the idea of this – looking forward to further developments!

  • charles raj 0

    Can I try it in Mac ??

    Terminal shows
    Required argument missing for command: install
    Directory does not exist: jupyter

    while running

    dotnet try jupyter install

    • Maria NaggagaMicrosoft employee 0

      You can use this on a mac. What you are experiencing has to do with zsh and anaconda .
      I have documented a few workarounds here

  • AJ76 0

    Great to see C# on Jupyter Notebooks!

    Not sure if I am doing something wrong, but Console.ReadLine(); does not seem to wait for imput.

    string a;
    a = Console.ReadLine();

    Just jump to the next input jupyter notebook entry In[].

    Am i doing anything wrong?

  • Nadezda Salauyova 0

    Is it possible to install the .NET kernel in Google Colab?

Feedback usabilla icon