Installing Python | Learning Python - Part 1

Installing python & jupyter notebook on windows & linux platform, a minimalistic approach.
Posted by Sarav, 4 years ago on Python

Introduction

Python is one of the most widely used programming languages and general-purpose programming languages that is easy to use developed by Guido Van Rossum in the year 1991. Python is one of the most popular dynamic programming language compared to other languages such as Java, Perl, PHP, and Ruby. It is often termed as a scripting language. It provides support for automatic memory management, multiple programming paradigms, and implements the concepts of object-oriented programming (OOP).

In this article, we will look at a minimalistic approach to install Python and Jupyter notebook to begin our epic journey to become a Data Scientist or a Python developer.

There are several ways to install Python on your computers such as by downloading and installing pre-packaged bundles like Anaconda or Miniconda. The main advantage of installing these packages is you don't have to install any of the dependencies, all come in a bundle.eg., Anaconda comes with several python packages and IDE such as spyder, VSCode, etc., However, you may not need all the packages for your use and the approach we are going to take has more control what's being installed on your computer and you get to choose what you need.

 

Installation - Plan

We are going to install the following components and I will explain how to install it on Window & Linux platform.

  • Python Installer (3.8.5)
  • VSCode (Text Editor)
  • Jupyter Notebook ( Interactive development tool)

 

Python

First, we will look at how to install and run Python on the Windows environment. Since we are going to take a minimalistic approach, first we need to download the installer. At the time of writing this article python version, 3.8.5 was the latest.

  • Navigate to https://www.python.org/
  • Click on the download section to choose the installation package architecture.

  • Click on "Windows".

  • Since most of the model computers use a 64-bit processor, I would recommend you install a 64-bit version of Python. In future articles, we will look at "Tensorflow" for deep learning, which requires a 64-bit version of python.
  • Run the installer as admin and make sure to check python to the system path.

To install Python on Linux we will use the apt package manager. This method is the easiest way to get and install Python. Before start installing you must fulfil the following pre-requisites.

  • Any Linux distribution, however, this method is tested on Ubuntu 18.04 and Ubuntu 20.04
  • User with administrator sudo privileges
  • Access to the terminal window
  1. Check python version
    Most of the Linux distribution comes with Python installed by default, to check the current version of Python installed, execute the following command in the terminal window.
    python3 --version

     

  2. Update apt repository
    sudo apt update

     

  3. Install python 3.8
    sudo apt install python3.8

     

  4. You can check the python version by running the command python3 --version
  5. Installing pip python package manager
    sudo apt install python-pip
    We have successfully installed python on Linux, the next step is to install VSCode and Jupyter Notebook.

 

VS Code

Visual Studio Code is an opensource text editor developed by Microsoft which is freely available for download and install on all platforms. It includes support for debugging, syntax highlighting, code completion, code snippets, etc., and more importantly, plugins/extensions which makes our development easy and hassle-free.

  • Once the software is downloaded, just run the setup file to begin the installation.
  • Installing VS Code is pretty much self-explanatory just choose the installation location and finish the installation by choosing default options.
  • Once the installation is completed, open VS Code and installs the following useful extensions that we will use in future tutorials.
    • HTML CSS Support.
    • Live Server
    • Python
    • Prettier code fomatter
    • Better Jinja
    • Live Sass compiler
  • To install extensions, open VSCode and click on the Extensions toolbox on the left side.

Jupyter Notebook

Jupyter Notebook is an open-source web-based solution for developing our Python projects in the form of Notebook. Jupyter Notebook allows us to create, share, and edit live code, visualization, texts, and markups. It is the first choice for data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

The installation of Jupyter Notebook is extremely easy as we will use the pip package installer that we installed during the installation of Python.

  • First, let's update the pip package installer by running the following in a command window/terminal window
    For Linux
    ---------------------------------------
    pip install --upgrade pip
    
    
    For Windows
    ---------------------------------------
    python -m pip install --upgrade pip
  • Next, let's install Jupyter Notebook by running a single line of code.
    pip install jupyter notebook
  • Open a command window/terminal window and run the following command.
    jupyter notebook

  • Once, the command is successfully executed, a browser will automatically open or you can simply copy and paste the link displayed in your command window to open Jupyter Notebook.

Congratulations, now we are all set to embark on our journey to the world of Python, Machine Learning, and Artificial Intelligence.

Similar Topics

Let's understand for & while loop visually

Posted by Sarav, 4 years ago on Python Learning Python

A gentle introduction to if, else & elif and for & while loops.

Posted by Sarav, 4 years ago on Python Learning Python

An introduction to data types, variables & type conversion

Posted by Sarav, 4 years ago on Python Learning Python