{"id":25064,"date":"2019-11-06T10:00:21","date_gmt":"2019-11-06T17:00:21","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=25064"},"modified":"2020-11-12T14:34:41","modified_gmt":"2020-11-12T21:34:41","slug":"net-core-with-juypter-notebooks-is-here-preview-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/net-core-with-juypter-notebooks-is-here-preview-1\/","title":{"rendered":".NET Core with Jupyter Notebooks &#8211;  Available today | Preview 1"},"content":{"rendered":"<p><strong>Please Note<\/strong>: The instructions in this post are obsolete. For the latest instructions please visit the <a href=\"https:\/\/github.com\/dotnet\/interactive\" target=\"_blank\" rel=\"noopener noreferrer\"> .NET Interactive<\/a> repo. For more information please look at our <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/net-interactive-is-here-net-notebooks-preview-2\/\" target=\"_blank\" rel=\"noopener noreferrer\">Preview 2 announcement<\/a> for more information.<\/p>\n<p>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.<\/p>\n<p>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 <strong>now .NET in Jupyter Notebooks<\/strong>.<\/p>\n<h3>Build .NET Jupyter Notebooks<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/72949473-60477900-3d56-11ea-8bc4-47352a613b78.png\" alt=\"\" \/><\/p>\n<p>To get started with .NET Notebooks, you will need the following:<\/p>\n<ul>\n<li><a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet-core\/3.0\">.NET Core 3.0 SDK<\/a><\/li>\n<li>Jupyter : You can install Jupyter on your machine using <a href=\"https:\/\/www.anaconda.com\/distribution\/\">Anaconda<\/a>. For alternative ways to install Jupyter please check out the <a href=\"https:\/\/jupyter.org\/install\">Jupyter&#8217;s Project official documentation<\/a>.<\/li>\n<li>Open the Anaconda Prompt (Windows) or Terminal (macOS) and verify that Jupyter is installed and present on the path:<\/li>\n<\/ul>\n<pre><code class=\"console\">&gt; jupyter kernelspec list\r\n  python3        ~\\jupyter\\kernels\\python3\r\n<\/code><\/pre>\n<ul>\n<li>Next, in an ordinary console, install the <code>dotnet interactive<\/code> <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.dotnet-interactive\/\" target=\"_blank\" rel=\"noopener noreferrer\">global tool<\/a>:<\/li>\n<\/ul>\n<pre><code class=\"console\">&gt; dotnet tool install -g dotnet-try\r\n<\/code><\/pre>\n<ul>\n<li>Install the .NET kernel by running the following within Anaconda Prompt:<\/li>\n<\/ul>\n<pre><code class=\"console\">&gt; dotnet try jupyter install\r\n[InstallKernelSpec] Installed kernelspec .net-csharp in ~\\jupyter\\kernels\\.net-csharp\r\n.NET kernel installation succeeded\r\n\r\n[InstallKernelSpec] Installed kernelspec .net-fsharp in ~\\jupyter\\kernels\\.net-fsharp\r\n.NET kernel installation succeeded\r\n<\/code><\/pre>\n<ul>\n<li>You can verify the installation by running the following again in the Anaconda Prompt:<\/li>\n<\/ul>\n<pre><code class=\"console\">&gt; jupyter kernelspec list\r\n  .net-csharp    ~\\jupyter\\kernels\\.net-csharp\r\n  .net-fsharp    ~\\jupyter\\kernels\\.net-fsharp\r\n  python3        ~\\jupyter\\kernels\\python3\r\n<\/code><\/pre>\n<h3>Features<\/h3>\n<p>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&#8217;s have a look at some of the features we have enabled.<\/p>\n<p>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.<\/p>\n<p>You can either explore the features listed below locally on your machine or online using the <a href=\"https:\/\/mybinder.org\/v2\/gh\/dotnet\/interactive\/master?urlpath=lab\">dotnet\/interactive binder image<\/a>.<\/p>\n<p>For the online documentation, please go to the Docs subfolder located in C# or F# folders.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/67905127-cb622480-fb46-11e9-903c-2ff8fbd789bc.png\" width=\"60%\" \/><\/p>\n<h4>List of features<\/h4>\n<p><strong>Display output<\/strong> : There are several ways to display output in notebooks. You can use any of the methods demonstrated in the image below.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/68237599-69d20800-ffd5-11e9-8452-a87543f33bb1.png\" width=\"60%\" \/><\/p>\n<p><strong>Object formatters<\/strong> : By default, the .NET notebook experience enables users to display useful information about an object in table format.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/67911312-7c26ee80-fb5c-11e9-9dcd-ac9d1e611a63.png\" width=\"60%\" \/><\/p>\n<p><strong>HTML output<\/strong> : 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.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/67909525-f0aa5f00-fb55-11e9-9164-7ce396edf668.png\" width=\"60%\" \/><\/p>\n<p><strong>Importing packages<\/strong> : You can load NuGet packages using the following syntax:<\/p>\n<p><code>#r \"nuget:&lt;package name&gt;,&lt;package version&gt;\"<\/code><\/p>\n<p>For Example<\/p>\n<pre><code># r \"nuget:Octokit, 0.32.0\"\r\n# r \"nuget:NodaTime, 2.4.6\"\r\nusing Octokit; using NodaTime; \r\nusing NodaTime.Extensions; \r\nusing XPlot.Plotly; \r\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/68219514-1e5b3200-ffb4-11e9-84cb-4828db2e166a.png\" width=\"60%\" \/><\/p>\n<p><strong>Charts with XPlot<\/strong><\/p>\n<p>Charts are rendered using <a href=\"https:\/\/fslab.org\/XPlot\/\">Xplot.Plotly<\/a>. As soon as users import XPlot.Plotly namespace into their notebooks(<code>using Xplot.Ploty;<\/code>), they can begin creating rich data visualizations in .NET.<\/p>\n<p><img decoding=\"async\" title=\"Plotting graphs in .NET using xplot\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/67912370-1b99b080-fb60-11e9-9839-0058d02488cf.png\" width=\"80%\" \/><\/p>\n<p>Please check the .NET Notebook online for more documentation and samples.<\/p>\n<h3>.NET Notebooks perfect for ML .NET and .NET for Apache\u00ae Spark\u2122<\/h3>\n<p>.NET notebooks bring iterative, interactive experiences popular in the worlds of machine learning and big data to .NET.<\/p>\n<h4>ML.NET<\/h4>\n<h6>ML.NET with Jupyter Notebooks<\/h6>\n<p>.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.<\/p>\n<p>For more details on how you can leverage ML.NET in Jupyter notebooks, check out this blog post on <a href=\"http:\/\/devblogs.microsoft.com\/cesardelatorre\/using-ml-net-in-jupyter-notebooks\/\">Using ML.NET in Jupyter notebooks<\/a>. The ML.NET team has put together several <a href=\"https:\/\/aka.ms\/mlnetonjupytersamplebinder\">online samples<\/a> for you to get started with. <img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/68125180-edf59400-fede-11e9-8021-e4287253b514.png\" alt=\"\" \/><\/p>\n<h4>.NET for Apache\u00ae Spark\u2122<\/h4>\n<h6>Big Data for .NET<\/h6>\n<p>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.<\/p>\n<p>So how can .NET developers and major .NET shops keep up with our data-oriented future? The answer is <a href=\"https:\/\/dot.net\/spark\">.NET for Apache Spark<\/a>, which you can now use from within notebooks!<\/p>\n<p>Today, .NET developers have two options for running .NET for Apache Spark queries in notebooks: <a href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/simply-unmatched-truly-limitless-announcing-azure-synapse-analytics\/\">Azure Synapse Analytics<\/a> Notebooks and <a href=\"https:\/\/aka.ms\/InstallDotNetOnHDISpark\">Azure HDInsight Spark + Jupyter Notebooks<\/a>. 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.<\/p>\n<p><strong>Option 1:<\/strong> <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/synapse-analytics\/\">Azure Synapse Analytics<\/a> ships with out-of-the-box .NET support for Apache Spark (C#).<\/p>\n<p><img decoding=\"async\" title=\"Azure Synapse Analytics with .NET C#\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/68147979-28742680-ff09-11e9-9258-4f9c1c31aa0a.png\" width=\"70%\" \/><\/p>\n<p><strong>Option 2:<\/strong> <a href=\"https:\/\/aka.ms\/InstallDotNetOnHDISpark\">Checkout the guide<\/a> on the .NET for Apache Spark <a href=\"https:\/\/github.com\/dotnet\/spark\">GitHub repo<\/a> to learn how to get started with .NET for Apache Spark in HDInsight + Jupyter notebooks. The experience will look like the image below.<\/p>\n<p><img decoding=\"async\" title=\".NET Apache Spark HDInsight\" src=\"https:\/\/user-images.githubusercontent.com\/2546640\/68058014-2b370780-fcce-11e9-84c7-b0860b17733e.png\" width=\"58%\" \/><\/p>\n<h3>Get Started with the .NET Jupyter Notebooks Today!<\/h3>\n<p>.NET kernel brings interactive developer experiences of Jupyter Notebooks to the .NET ecosystem. We hope you have fun creating .NET notebooks. Please checkout our <a href=\"https:\/\/github.com\/dotnet\/try\">repo<\/a> to learn more and let us know what you build.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can now 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.  And you can get started with it today!<\/p>\n","protected":false},"author":3344,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,196,756,636],"tags":[],"class_list":["post-25064","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-dotnet-core","category-csharp","category-fsharp"],"acf":[],"blog_post_summary":"<p>You can now 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.  And you can get started with it today!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/25064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/3344"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=25064"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/25064\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=25064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=25064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=25064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}