• Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard
CSEstack

What do you want to Learn Today?

  • Programming
    • Tutorial- C/C++
    • Tutorial- Django
    • Tutorial- Git
    • Tutorial- HTML & CSS
    • Tutorial- Java
    • Tutorial- MySQL
    • Tutorial- Python
    • Competitive Coding Challenges
  • CSE Subject
    • (CD) Compiler Design
    • (CN) Computer Network
    • (COA) Computer Organization & Architecture
    • (DBMS) Database Management System
    • (DS) Data Structure
    • (OS) Operating System
    • (ToA) Theory of Automata
    • (WT) Web Technology
  • Interview Questions
    • Interview Questions- Company Wise
    • Interview Questions- Coding Round
    • Interview Questions- Python
    • Interview Questions- REST API
    • Interview Questions- Web Scraping
    • Interview Questions- HR Round
    • Aptitude Preparation Guide
  • GATE 2022
  • Linux
  • Trend
    • Full Stack Development
    • Artificial Intelligence (AI)
    • BigData
    • Cloud Computing
    • Machine Learning (ML)
  • Write for Us
    • Submit Article
    • Submit Source Code or Program
    • Share Your Interview Experience
  • Tools
    • IDE
    • CV Builder
    • Other Tools …
  • Jobs

How to Install and Run Jupyter Python Notebook [Complete Guide with Example]

Aniruddha Chaudhari/58899/6
CodePythonSoftware Installation

In this tutorial, you will learn Python commands to install and run Jupyter Python Notebook in Windows/Linux/macOS using the pip tool.

If you are using MacBook, refer exclusive tutorial about installing Jupyter on macOS. For Windows and Linux, continue reading this tutorial.

Jupyter is an open-source project which provides an interactive platform for executing programming code. It allows you to add a comment and make it more explanatory.

If you want to install Jupyter for Python, Jupyter is available as a Python module for Python versions 2 and 3. It is easy to install it using the pip tool.

Table of Contents

  • Installing Jupyter Python Notebook For Python 2 and 3
  • How to Write and Run Jupyter Python Notebook  | Your First Program
  • Different Types of Cells in Jupyter Python Notebook
  • Keynotes for Using Python Jupyter Notebook
  • Advantages of Using Jupyter Notebook

Installing Jupyter Python Notebook For Python 2 and 3

Pip is the default package management system or tool for installing/uninstalling and managing different packages in Python. It provides an OS-independent system, so you can use it for any of the operating systems like Windows, Linux (Ubuntu), macOS, etc…

You can install the Jupyter Notebook from the Python standard library with simple commands.

Python 3.7

py -m pip install --upgrade pip
py -m pip install jupyter

Here, the first command is to upgrade the pip. It is always good practice to upgrade pip before installing any Python module.

Note: Managing the Python module is crucial for Python developers. Learn more about managing Python packages using Pip.

Running Notebook Jupyter 

Once you installed it, run the following command to run the notebook.

py -m notebook

Python 3 (older versions)

python3 -m pip3 install --upgrade pip
python3 -m pip3 install jupyter

Remember, pip is a package manager tool by default comes with Python binaries. The older Python 3 version has the tool pip3. So you have to use pip3 instead of pip.

Running Jupyter Notebook

python3 -m notebook

Python 2

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

Commands for installing Python packages for Python 2 versions are pretty straightforward.

Running Jupyter Notebook

python -m notebook

Jupyter creates the localhost server to execute the Python programs. Running the Jupyter notebook command will open the notebook page in the new tab of the browser as localhost.

How to Write and Run Jupyter Python Notebook  | Your First Program

You can see the local directories in your browser notebook.

Follow the steps for Writing Your First Python Program in Notebook:

  • Select the directory where you want to save the Jupyter notebook program.
  • Then click on the new drop-down menu option (right-top option).
  • Select the Python version. (Here I have installed a notebook for Python 3).
  • It will open a new tab in your browser where you can write your first program.
  • Write your Python code and run.
install python notebook jupyter

You can rename the Jupyter file by double-clicking on it. I have renamed it to testProg.

running program in python jupyter notebook

In the above Image, you can see the different cells where you can split your code.

It’s pretty easy to execute a Python program, isn’t it? You don’t need to execute any command line code. Just click on Run, and you have done with your Job.

Let’s find little more about using different types of cells in Jupyter.

Different Types of Cells in Jupyter Python Notebook

There are majorly three types of cells in Jupyter.

Code:

This cell is to write and execute actual Python code.

Markdown:

This advanced feature comes with Jupyter where you can write simple HTML commands to decorate the text inside the browser.

Heading:

As its name, with this cell, you can add a heading to your Python Jupyter program. If your program has a large number of lines and cells, it is good practice to add headings.  It is easy for understanding and maintaining Python code.

Keynotes for Using Python Jupyter Notebook

  • You can add as many cells in the file before and after the selected cell.
  • You can mark each cell with different tags – Code, Markdown, Heading.
  • Only lines from the code cell will be executed.
  • To run the cell – select the cell and then click on “Run”
  • You can see the output of the program just below the code cell.

Note:
Jupyter notebook is deprecated and it is being replaced with JupyterLab which is nothing but the next-generation version of Jupyter notebook. JupyterLab comes with some more advanced features than Jupyter.

That’s all from this tutorial to install and run Jupyter Python Notebook.

Advantages of Using Jupyter Notebook

Once you start using it, you will just love it. Running Python programs in Jupyter is pretty easy in the browser as compared to running Python code in different text editors. You don’t need to run a command every time to execute the code.

This tool is the best to explore data science libraries and projects.

If you are writing or practicing coding, adding explanatory comments for your code will help. Many Python tutors use Jupyter in their classrooms to teach Python and other programming languages. Even I am using Jupyter in my Data Science course.

This article covered all the detail required to execute your Python code in the Jupyter notebook. For more detail, you can visit Jupyter’s Official website.

What’s your experience or the best thing you like about Jupyter?

Shout out in the comment.

JupyterPython
Aniruddha Chaudhari
I am complete Python Nut, love Linux and vim as an editor. I hold a Master of Computer Science from NIT Trichy. I dabble in C/C++, Java too. I keep sharing my coding knowledge and my own experience on CSEstack.org portal.

Your name can also be listed here. Got a tip? Submit it here to become an CSEstack author.

Comments

  • Reply
    Alam
    July 2, 2019 at 6:24 am

    Jupyter notebook is best for Data Science. I’m a web developer and started learning data science.

    • Reply
      Aniruddha Chaudhari
      July 2, 2019 at 9:12 am

      That’s Great!

  • Reply
    Besty Dave
    July 26, 2019 at 12:54 am

    Aniruddha, I started learning Data Science. We have been asked to use Jupyter Notebook by our mentor. I’m just loving it. It is very simple and easy to use.

    • Reply
      Aniruddha Chaudhari
      July 26, 2019 at 9:00 am

      You’re right, Besty! For Data Science, Notebook is very powerful and quick. I’m sure, you will love it even more as you explore it further.

  • Reply
    Dave
    September 11, 2020 at 4:23 am

    Thanks. What other tools do you use a lot in Data Science?

    • Reply
      Aniruddha Chaudhari
      September 16, 2020 at 10:46 pm

      It depends on the requirement mostly. If you are interested to explore, you can have a look at these Data Science tools.

Leave a Reply Cancel reply

Prerequisite for Data Science

Basic Python Programming

Data Science using Python

  • Skills Required for DS
  • Mathematics for DS
  • Python vs R for ML, AI & DS
  • DIKW Pyramid Model
  • Jupyter Setup
  • Python Libraries for DS
  • Numpy Tutorial
  • 19 DS Interview Questions

Artificial Intelligence (AI)

  • Benefits of AI to Human
  • Myths about AI
  • Pros and Cons of AI
  • Artificial Intelligence Agents

© 2022 – CSEstack.org. All Rights Reserved.

  • Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard