Trending September 2023 # Jupyter Notebook Tutorial: How To Install &Amp; Use Jupyter? # Suggested October 2023 # Top 9 Popular |

Trending September 2023 # Jupyter Notebook Tutorial: How To Install &Amp; Use Jupyter? # Suggested October 2023 # Top 9 Popular

You are reading the article Jupyter Notebook Tutorial: How To Install &Amp; Use Jupyter? updated in September 2023 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested October 2023 Jupyter Notebook Tutorial: How To Install &Amp; Use Jupyter?

What is Jupyter Notebook?

Jupyter Notebook is an open-source web application for writing and sharing live codes, equations, visualizations with rich text elements. It provides a convenient way to write paragraph, equations, titles, links and figures to run data analysis. It is also useful for sharing interactive algorithms with your audience for teaching or demonstrating purpose.

In this Jupyter Notebook tutorial, you will learn-

Introduction to Jupyter Notebook App

The Jupyter Notebook App is the interface where you can write your scripts and codes through your web browser. The app can be used locally, meaning you don’t need internet access, or a remote server.

Each computation is done via a kernel. A new kernel is created each time you launch a Jupyter Notebook.

How to use Jupyter Notebook

In the session below, you will learn how to use Jupyter Notebook. You will write a simple line of code to get familiar with the environment of Jupyter.

Step 1) You add a folder inside the working directory that will contains all the notebooks you will create during the tutorials about TensorFlow.

Open the Terminal and write

mkdir jupyter_tf jupyter notebook

Code Explanation

mkdir jupyter_tf: Create a folder names jupyter_tf

jupyter notebook: Open Jupyter web-app

You can rename it Introduction_jupyter

In AWS Jupyter Notebook, you write codes, annotation or text inside the cells.

Inside a cell, you can write a single line of code.

For instance, if you write following code inside a cell.

It will produce this output.

Step 5) You are ready to write your first line of code. You can notice the cell have two colors. The green color mean you are in the editing mode.

The blue color, however, indicates you are in executing mode.

You first line of code will be to print Guru99!. Inside the cell, you can write


There are two ways to run a code in Jupyter:

Keyboard Shortcuts

You can see the code is printed below the cell and a new cell has appeared right after the output.

A faster way to run a code is to use the Keyboard Shortcuts. To access the Keyboard Shortcuts, go to Help and Keyboard Shortcuts

Below the list of shortcuts for a MacOS keyboard. You can edit the shortcuts in the editor.

Following are shortcuts for Windows

Write this line

print("Hello world!")

and try to use the Keyboard Shortcuts to run the code. Use alt+enter. it will execute the cell and insert a new empty cell below, like you did before.

Note: Jupyter automatically saves the notebook with checkpoint. If you have the following message:

It means Jupyter didn’t save the file since the last checkpoint. You can manually save the notebook

You will be redirected to the main panel. You can see your notebook has been saved a minute ago. You can safely logout.

Install Jupyter Notebook with AWS

Below is a step by step process on how to install and run Jupyter Notebook on AWS:

If you do not have an account at AWS, create a free account here.

We will proceed as follow

PART 1: Set up a key pair

Step 1) Go to Services and find EC2

You can call it Docker key

Step 4) Copy and paste it into the folder key. We will need it soon.

For Mac OS user only

This step concerns only Mac OS user. For Windows or Linux users, please proceed to PART 2

You need to set a working directory that will contain the file key

First of all, create a folder named key. For us, it is located inside the main folder Docker. Then, you set this path as your working directory

mkdir Docker/key cd Docker/key

PART 2: Set up a security group

Step 1) You need to configure a security group. You can access it with the panel

Step 3) In the next Screen

Enter Security group name “jupyter_docker” and Description Security Group for Docker

You need to add 4 rules on top of

ssh: port range 22, source Anywhere

Custom TCP: port range 8888, source Anywhere

    Step 4) The newly created Security Group will be listed

    Part 3: Launch instance

    You are finally ready to create the instance

    The default server is enough for your need. You can choose Amazon Linux AMI. The current instance is 2023.03.0.

    AMI stands for Amazon Machine Image. It contains the information required to successfully starts an instance that run on a virtual server stored in the cloud.

    Note that AWS has a server dedicated to deep learning such as:

    Deep Learning AMI (Ubuntu)

    Deep Learning AMI

    Deep Learning Base AMI (Ubuntu)

    All of them Comes with latest binaries of deep learning frameworks pre-installed in separate virtual environments:







    Fully-configured with NVidia CUDA, cuDNN and NCCL as well as Intel MKL-DNN

    Step 2) Choose t2.micro. It is a free tier server. AWS offers for free this virtual machine equipped with 1 vCPU and 1 GB of memory. This server provides a good tradeoff between computation, memory and network performance. It fits for small and medium database

    Step 6) Choose the security group you created before, which is jupyter_docker

    Step 8 ) The last step is to link the key pair to the instance.

    Step 8) Instance will launch

    Step 9) Below a summary of the instances currently in use. Note the public IP

    You will find the connection detials

    Launch your instance (Mac OS users)

    At first make sure that inside the terminal, your working directory points to the folder with the key pair file docker

    run the code

    chmod 400 docker.pem

    Open the connection with this code.

    There are two codes. in some case, the first code avoids Jupyter to open the notebook.

    In this case, use the second one to force the connection in Jupyter Notebook on EC2.

    # If able to launch Jupyter # If not able to launch Jupyter

    The first time, you are prompted to accept the connection

    Launch your instance (Windows users)

    Step 1) Go to this website to download PuTTY and PuTTYgen PuTTY

    You need to download

    PuTTY: launch the instance

    PuTTYgen: convert the pem file to ppk

    Now that both software are installed, you need to convert the .pem file to .ppk. PuTTY can only read .ppk. The pem file contains the unique key created by AWS.

    Step 5) Save the Key

    Step 6) Go to AWS and copy the public DNS

    Open PuTTY and paste the Public DNS in the Host Name

    Step 7)

    On the left panel, unfold SSH and open Auth

    Browse the Private Key. You should select the .ppk

    Step 8)

    Step 9)

    You need to login as: ec2-user

    Step 10)

    You are connected to the Amazon Linux AMI.

    Part 4: Install Docker

    While you are connected with the server via Putty/Terminal, you can install Docker container.

    Execute the following codes

    sudo yum update -y sudo yum install -y docker sudo service docker start sudo user-mod -a -G docker ec2-user exit

    Launch again the connection

    Windows users use SSH as mentioned above

    Part 5: Install Jupyter

    Step 1) Create Jupyter with,

    pre-built image.

    ## Tensorflow docker run -v ~/work:/home/jovyan/work -d -p 8888:8888 jupyter/tensorflow-notebook ## Sparkdocker run -v ~/work:/home/jovyan/work -d -p 8888:8888 jupyter/pyspark-notebook

    Code Explanation

    docker run: Run the image

    v: attach a volume

    ~/work:/home/jovyan/work: Volume

    8888:8888: port

    jupyter/datascience-notebook: Image

    For other pre-build images, go here

    Allow preserving Jupyter AWS notebook

    sudo chown 1000 ~/work

    Step 2) Install tree to see,

    our working directory next

    sudo yum install -y tree

    Step 3) Check the container and its name

    Use command

    docker ps

    Get the name and use the log to open Jupyter. In this Jupyter tutorial, the container’s name is vigilant_easley. Use command docker logs vigilant_easley

    Get the URL

    Step 4) In the URL,

    Replace (90a3c09282d6 or with Public DNS of your instance

    Step 5) The new URL becomes,

    Step 6) Copy and paste the URL into your browser.

    Jupyter Opens

    Step 7) You can write a new Notebook,

    in your work folder

    Part 6: Close connection

    Close the connection in the terminal


    Go back to AWS and stop the server.


    If ever docker doesnot work, try to rebuilt image using

    docker run -v ~/work:/home/jovyan/work -d -p 8888:8888 jupyter/tensorflow-notebook Summary

    Jupyter notebook is a web application where you can run your Python and R codes. It is easy to share and deliver rich data analysis with Jupyter.

    To launch jupyter, write in the terminal: jupyter notebook

    You can save you notebook whereever you want

    A cell contains your Python code. The kernel will read the code one by one.

    You can use the shortcut to run a cell. By default: Ctrl+Enter

    You're reading Jupyter Notebook Tutorial: How To Install &Amp; Use Jupyter?

    Update the detailed information about Jupyter Notebook Tutorial: How To Install &Amp; Use Jupyter? on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!