DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Docker + .NET APIs: Simplifying Deployment and Scaling
  • Getting Started With C# DataFrame and XPlot.Ploty
  • Multi-Scale Feature Learning in CNN and U-Net Architectures
  • Designing API-First EMR Architectures in .NET: Enabling Modular Growth in Compliance-Driven Systems

Trending

  • Building AI-Powered Java Applications With Jakarta EE and LangChain4j
  • Getting Started With Agentic Workflows in Java and Quarkus
  • Multi-Scale Feature Learning in CNN and U-Net Architectures
  • S3 Vectors: How to Build a RAG Without a Vector Database
  1. DZone
  2. Coding
  3. Languages
  4. Using .NET Core in Jupyter Notebook

Using .NET Core in Jupyter Notebook

Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text.

By 
Jirapongse Phuriphanvichai user avatar
Jirapongse Phuriphanvichai
·
May. 20, 21 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
10.2K Views

Join the DZone community and get the full member experience.

Join For Free

Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It can be used as a tool for interactively developing and presenting data science projects. Mostly, it is used with Python and R which are scripting languages. However, it can also be used with compiled languages, such as .NET programming languages, Go, and Julia. For a list of supported programming languages, please refer to the Jupyter kernels page in GitHub.

This article explains steps to set up Jupyter Notebook for .NET Core programming languages on Windows 10.  It is based on the .NET Notebooks Preview 2 that supports C#, F#, and PowerShell. This article also provides few C# examples that demonstrate how to use DataFrame and Charts.

Microsoft .NET Core

.NET Core is an open-source and cross-platform software framework that can run on various operating systems, such as Windows, Linux, and macOS. It is a project of the .NET Foundation and released under the MIT and Apache 2 licenses.

The first version (.NET Core 1.0) was released on June 27, 2016. At the time of this writing, the current version is .NET 5.0 released on November 10, 2020. In .NET 5.0, the "Core" has been dropped from the name to emphasize that this is the main implementation of .NET going forward and it supports more types of applications and more platforms than .NET Core or .NET Framework.

Currently, Microsoft supports the .NET Core 2.1, .NET Core 3.1, and .NET 5.

Next, I will demonstrate steps to set up Jupyter Notebook for .NET Core 3.1 on Windows 10.

Steps to Setup Jupyter Notebook for .NET

1. Install Python

Python packages are available on the Python website. It supports many operating systems, such as Windows, Linux/Unix, and Mac OS X.

Download the Windows version and then install it on the machine. In this article, Python 3.9.4 64bit is used. You need to verify the installation path or choose the Add Python 3.9 to PATH option to add the Python installation path to the PATH environment variable. However, the Add Python 3.9 to PATH option may introduce the version conflicts among the installed Python versions. If you have multiple versions of Python installed on the machine, please be cautious of this option.

Install Python Setup

After installing, open the Windows Command Prompt to verify the version of Python (python --version). 

Administrator: Command Prompt

You may install different Python Distributions, such as Anaconda. Please refer to the Anaconda website for more information.

2. Install Jupyter Notebook

Jupyter Notebook can be installed with the pip command. Open the Windows Command Prompt and use the following commands to install Jupyter Notebook.

Shell
 
python -m pip install --upgrade pip  
python -m pip install jupyter


Install Jupyter Notebook

Then, run 'Jupyter notebook' from the Windows Command Prompt to start the Jupyter Notebook. 

Running Jupyter Notebook

At this time, the Jupyter Notebook only supports Python 3.

For different Python distributions, please refer to the distribution websites regarding how to install Jupyter Notebook.

3. Install .NET Core 3.1

You can download .NET Core 3.1 from the .NET Core website.

Install .NET Core 3.1

After the installation was successful, run the 'dotnet ––version' command in the command prompt to verify the version of .NET Core.

dotnet --version Verification

4. Install dotnet-interactive Kernel

.NET on the Jupyter Notebook relies on the Microsoft.dotnet-interactive package which is a command-line tool for interactive programming with C#, F#, and PowerShell, including support for Jupyter Notebooks.

Run the following command in the command prompt to install Microsoft.dotnet-interactive.

Shell
 
dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.155302


Installing dotnet-interactive Kernel

The versions higher than 1.0.155302 are for NET 5.0.

Then, run the following command to add dotnet-interactive to the Jupyter Notebook.

Shell
 
dotnet interactive jupyter install


Install Jupyer into dotnet

Finally, run 'jupyter notebook' via the Windows Command Prompt. Now, the Jupyter Notebook supports C#, F#, and PowerShell programming languages. 

Jupyter Supports Additional Languages Now

C# Examples

You can refer to the following examples that show how to use C# in Jupyter Notebook.

  1. Getting Started with C# DataFrame and XPlot.Plotly: This example demonstrates how to use DataFrame in Microsoft.Data.Analysis package and XPlot.Plotly library to plot charts.
  2. Getting Started with Eikon Data API .NET in Jupyter Notebook: This example demonstrates how to use Refinitiv .NET Eikon Data API on Jupyter Notebook to retrieve the latest data, historical data, symbology, and news. It uses the EikonDataApi package to retrieve data from Eikon and uses XPlot.Plotly package to draw charts.

References

1.  En.wikipedia.org. 2016. .NET Core - Wikipedia. [online] Available at: <https://en.wikipedia.org/wiki/.NET_Core> [Accessed 28 April 2021].
2. Microsoft. n.d. .NET Core and .NET 5 official support policy. [online] Available at: <https://dotnet.microsoft.com/platform/support/policy/dotnet-core> [Accessed 28 April 2021].
3. Docs.microsoft.com. n.d. .NET introduction and overview. [online] Available at: <https://docs.microsoft.com/en-us/dotnet/core/introduction> [Accessed 28 April 2021].
4. Python.org. 2021. Download Python. [online] Available at: <https://www.python.org/downloads/> [Accessed 28 April 2021].
5. Nuget.org. n.d. Microsoft.dotnet-interactive 1.0.221505. [online] Available at: <https://www.nuget.org/packages/Microsoft.dotnet-interactive/> [Accessed 28 April 2021].
6. Naggaga, M., 2020. .NET Interactive is here! | .NET Notebooks Preview 2 | .NET Blog. [online] .NET Blog. Available at: <https://devblogs.microsoft.com/dotnet/net-interactive-is-here-net-notebooks-preview-2/> [Accessed 28 April 2021].
7. Docs.microsoft.com. n.d. What's new in .NET 5. [online] Available at: <https://docs.microsoft.com/en-us/dotnet/core/dotnet-five> [Accessed 28 April 2021].

jupyter notebook .NET Net (command)

Opinions expressed by DZone contributors are their own.

Related

  • Docker + .NET APIs: Simplifying Deployment and Scaling
  • Getting Started With C# DataFrame and XPlot.Ploty
  • Multi-Scale Feature Learning in CNN and U-Net Architectures
  • Designing API-First EMR Architectures in .NET: Enabling Modular Growth in Compliance-Driven Systems

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook