This is the very basic question asked by the interviewer, and as Python developers, we should know about pip and pip3 significance in the python world.

I am going to explain in a very basic approach, and you will thank me later after reading this small capsule sharing with you here. It will really help you to understand better.

PIP stands for

You can say anything out of four written below:

  • Package Installer for Python
  • Preferred Installer Program
  • Pip Install packages
  • Pip Install Python
Python Mantra

Definition of PIP

PIP is a standard package manager that comes along with python to install additional packages that are not part of the python standard library.

Use of PIP / PIP3

We use PIP or PIP3 to install additional libraries which do not come with the python standard library.

Example:

  • Pandas
  • PyTorch
  • SciPy
  • Numpy
  • Matplotlib
  • Requests

Suppose you want to perform data manipulation and analysis using the Pandas (taking the example of pandas here) library in python, so you need to install Pandas additional package using PIP because pandas are not the part of python standard library.

If you will write a code using pandas and try to run it, you will get the below error if the library is not installed on your computer.

Traceback (most recent call last):

File "c:\User\username\AppData\Local\Programs\Python\Python310\Scripts\Test.py", line 1, in <module>

    import pandas

ModuleNotFoundError: No module named 'pandas'

PS C:\User\username\AppData\Local\Programs\Python\Python310\Scripts> 
Check PIP and PIP3 in Python

Note: Now PIP comes into the picture to install pandas.

How to use PIP / PIP3 to install an additional package?

Step 1: 

Go to the location where python is installed (Default Path given below for windows 10 and 11)

c:\User\username\AppData\Local\Programs\Python\Python310

Note: Go to the location where you have installed your version [If the path changed during the installation of python 3.10]

Step 2: 

Go to the Scripts folder and you will get two pip version

c:\User\username\AppData\Local\Programs\Python\Python310\Scripts

  • pip
  • pip3

Run the command prompt from this folder or if you have directly opened your command prompt from the search bar, please change the directory and come to this folder.

C:\User\username\AppData\Local\Programs\Python\Python310\Scripts>pip3 install pandas
Install Pandas

Press Enter from the keyboard

C:\User\username\AppData\Local\Programs\Python\Python310\Scripts>pip3 install panda

Collecting pandas

  Downloading pandas-1.4.3-cp310-cp310-win_amd64.whl (10.5 MB)

     ---------------------------------------- 10.5/10.5 MB 1.9 MB/s eta 0:00:00

Collecting pytz>=2020.1

  Downloading pytz-2022.2.1-py2.py3-none-any.whl (500 kB)

     ---------------------------------------- 500.6/500.6 kB 3.5 MB/s eta 0:00:00

Collecting numpy>=1.21.0

  Downloading numpy-1.23.2-cp310-cp310-win_amd64.whl (14.6 MB)

     ---------------------------------------- 14.6/14.6 MB 4.1 MB/s eta 0:00:00

Requirement already satisfied: python-dateutil>=2.8.1 in c:\User\username\appdata\local\programs\python\python310\lib\site-packages (from pandas) (2.8.2)

Requirement already satisfied: six>=1.5 in c:\user\username\appdata\local\programs\python\python310\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)

Installing collected packages: pytz, numpy, pandas

  WARNING: The script f2py.exe is installed in 'C:\User\username\AppData\Local\Programs\Python\Python310\Scripts' which is not on PATH.

  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Successfully installed numpy-1.23.2 pandas-1.4.3 pytz-2022.2.1

[notice] A new release of pip available: 22.2.1 -> 22.2.2

[notice] To update, run: C:\User\username\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip

C:\User\username\AppData\Local\Programs\Python\Python310\Scripts>s

Successfully installed numpy-1.23.2 pandas-1.4.3 pytz-2022.2.1
Information after installing Pandas

Wow, you have installed the Pandas package using pip3 standard package manager.

Difference between PIP vs PIP3

We have two python versions available on Python official website (https://www.python.org/downloads/)

  • Python 2.x.x (Community support ended in 2020)
  • Python 3.x.x

We try to understand PIP and PIP3 uses through a few cases below:

Case 1: 

Suppose you are using both versions on your machine due to some project-specific reason (If some old code you are using is written in Python2).

  • Pip3 will use to install packages for the Python3-supported library version.
  • Pip will use to install packages for the Python2-supported library version.

Case 2: 

You are using the latest Python 3.x.x (python 3.4 or later) version only.

You can use any command (pip or pip3) to install packages, and python will take care to install compatible packages.

PIP or PIP3 not showing in the Scripts Folder

You are using an older version of python. You will get both pip and pip3 in the scripts folder if the version you are using is python 3.4 and python 2.7.9 or later.

Solution 1: 

If you are using an older version, you can upgrade to the latest one.

https://www.python.org/downloads

Python Download Link (Copy above link in browser and install)

Solution 2: 

If you do not want to upgrade due to any project-specific reason, you can go below line and get-pip.py file.

https://bootstrap.pypa.io/

Download Link (Copy above link in browser and install)

Solution 3: 

You can download it from the below link as well.

https://pypi.org/project/pip/

Download Link (Copy above link in browser and install)

What is a Package in Python?

Python package means all the supporting files needed for a module (Python code library) to install and run on the machine.

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

Stay Connected Stay Safe. Thank you.

Know About Us


Rahul Verma

17+ years of experience in software development, IoT, telecom, banking, finance, embedded systems, data science, machine learning, and artificial intelligence with multiple market leaders worldwide. I hope you found this blog post informative and helpful. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *