{"id":9531,"date":"2021-08-23T14:48:01","date_gmt":"2021-08-23T14:48:01","guid":{"rendered":"https:\/\/linuxways.net\/?p=9531"},"modified":"2021-08-23T14:48:01","modified_gmt":"2021-08-23T14:48:01","slug":"how-to-install-jupyter-notebook-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-jupyter-notebook-on-ubuntu-20-04\/","title":{"rendered":"How to Install Jupyter Notebook on Ubuntu 20.04"},"content":{"rendered":"<p>Once referred to as iPython Notebook, <a href=\"https:\/\/jupyter.org\/\">Jupyter Notebook<\/a> is an open-source web application that allows users to interactively run code on a web browser alongside some visualizations. Jupyter Notebook is mostly used for data science which includes carrying out operations such as data visualization, statistical modeling, numerical simulation, data cleaning, machine learning and so much more.<\/p>\n<p>Join us as we embark on the installation of Jupyter Notebook on Ubuntu 20.04.<\/p>\n<h2><strong>Step 1: Update the package index <\/strong><\/h2>\n<p>The first step in installing Jupyter Notebook is to update or refresh the package index and repositories of the local system. To achieve this, execute the command:<\/p>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"187\" class=\"wp-image-9532\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-445.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-445.png 785w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-445-300x71.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-445-768x183.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/strong><\/p>\n<h2><strong>Step 2: Install Pip and other Python dependencies<\/strong><\/h2>\n<p>Pip &#8211; which is a Python package manager &#8211; will be required to install Jupyter Notebook towards the end. As such we are going to install pip3 alongside the <strong>python3-dev <\/strong>package which is used for the compilation of Python extension modules.<\/p>\n<pre><strong>$ sudo apt install python3-pip python3-dev<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"219\" class=\"wp-image-9533\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-446.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-446.png 785w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-446-300x84.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-446-768x214.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/strong><\/p>\n<h2><strong>Step 3: Upgrade pip &amp; virtual environment package<\/strong><\/h2>\n<p>Next, we are going to install the virtual environment package. But first, we will upgrade pip.<\/p>\n<pre><strong>$ sudo -H pip3 install --upgrade pip<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"237\" class=\"wp-image-9534\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-447.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-447.png 788w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-447-300x90.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-447-768x231.png 768w\" sizes=\"auto, (max-width: 788px) 100vw, 788px\" \/><\/p>\n<p>Thereafter, install the <strong>virtualenv<\/strong> Python tool. This is a tool that is used for creating isolated Python environments.<\/p>\n<pre><strong>$ sudo -H pip3 install virtualenv<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"796\" height=\"239\" class=\"wp-image-9535\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-448.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-448.png 796w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-448-300x90.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-448-768x231.png 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><\/p>\n<h2><strong>Step 4: Create a virtual environment for launching Jupyter<\/strong><\/h2>\n<p>Once the requisite packages have been installed, you need to create a directory that will serve as the code directory. Inside this directory, you will create a virtual environment and later use it to install Jupyter Notebook.<\/p>\n<p>In our case, we will create a directory called <strong>jupyter_dir <\/strong>and navigate into it using the following commands.<\/p>\n<pre><strong>$ mkdir jupyter_dir<\/strong><\/pre>\n<pre><strong>$ cd jupyter_dir<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"792\" height=\"146\" class=\"wp-image-9536\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-449.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-449.png 792w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-449-300x55.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-449-768x142.png 768w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/p>\n<p>Next, create a virtual environment using the command. Here our virtual environment is called <strong>jupyter_env<\/strong><\/p>\n<pre><strong>$ virtualenv jupyter_env<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"792\" height=\"221\" class=\"wp-image-9537\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-450.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-450.png 792w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-450-300x84.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-450-768x214.png 768w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/p>\n<p>Next, activate the virtual environment using the <strong>source<\/strong> command-line tool.<\/p>\n<pre><strong>$ source jupyter_env\/bin\/activate<\/strong><\/pre>\n<p>Once you run the command, notice that the prompt changes to the name of the virtual environment <strong>(jupyter_env)<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"798\" height=\"186\" class=\"wp-image-9538\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-451.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-451.png 798w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-451-300x70.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-451-768x179.png 768w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><\/p>\n<h2><strong>Step 5: Install and launch Jupyter Notebook<\/strong><\/h2>\n<p>After activating the virtual environment, the last step is to install Jupyter Notebook. To achieve this, use the pip3 package manager as shown.<\/p>\n<pre><strong>$ pip3 install jupyter<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"270\" class=\"wp-image-9539\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-452.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-452.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-452-300x103.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-452-768x263.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>When the installation is complete, launch Jupyter Notebook as shown.<\/p>\n<pre><strong>$ jupyter notebook<\/strong><\/pre>\n<p>Some output will be displayed as shown confirming the initialization and the running status of the Jupyter Notebook platform. At the very bottom, click to browse one of the links on a web browser.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"798\" height=\"420\" class=\"wp-image-9540\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-453.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-453.png 798w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-453-300x158.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-453-768x404.png 768w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><\/p>\n<p>This takes you to the home screen of the Jupyter Notebook web application.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1366\" height=\"348\" class=\"wp-image-9541\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-454.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-454.png 1366w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-454-300x76.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-454-1024x261.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-454-768x196.png 768w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/p>\n<p>To create a project click on the \u2018<strong>New<\/strong>\u2019 button and select the \u2018<strong>Python3<\/strong>\u2019 option.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1201\" height=\"351\" class=\"wp-image-9542\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-455.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-455.png 1201w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-455-300x88.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-455-1024x299.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-455-768x224.png 768w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/p>\n<p>This launches a code editor shown that provides a line-by-line coding environment. Here, I have run 2 simple Python programs.<\/p>\n<p>The first program prints out the message \u201c<strong>Hello guys, Welcome to Jupyter Notebook<\/strong>\u201d and the second one sums the values of two variables.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1366\" height=\"532\" class=\"wp-image-9543\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-456.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-456.png 1366w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-456-300x117.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-456-1024x399.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-456-768x299.png 768w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>And that\u2019s it, folks. In this brief tutorial, you have learned how to install the Jupyter Notebook web application on Ubuntu 20.04.<\/p>","protected":false},"excerpt":{"rendered":"<p>Once referred to as iPython Notebook, Jupyter Notebook is an open-source web application that allows users to interactively run code on a web browser alongside some visualizations. Jupyter&hellip;<\/p>","protected":false},"author":1,"featured_media":9609,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[501,100],"class_list":["post-9531","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-jupyter-notebook","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=9531"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9531\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/9609"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=9531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=9531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=9531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}