The Wayback Machine - https://web.archive.org/web/20241009165738/https://www.geeksforgeeks.org/python-pip/
Open In App

Python PIP

Last Updated : 25 Sep, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

In this article, we will discuss what is PIP, and how to install, upgrade, and uninstall packages using Python PIP. So before starting and using it, let us understand what is a Python PIP.

What is Package in Python?

Package refers to a distribution of Python code that includes one or more modules or libraries. These packages are typically published on the Python Package Index (PyPI) and can be easily installed using pip. Python packages may contain modules, sub-packages, and additional resources such as documentation and data files.

What is Python PIP?

Python PIP is the package manager for Python packages. We can use PIP to install packages that do not come with Python. The basic syntax of PIP commands in the command prompt is: 

pip 'arguments'

How to Install Python PIP?

Python PIP comes pre-installed on 3.4 or older versions of Python. To Check if PIP is Installed or not type the below command in the terminal.

pip --version

This command will tell the version of the Pip if it is already installed in the system.

Checking PIP version

Checking Python PIP version

If you do not have PIP installed on your system refer to the below articles.

How to Install Package with Python PIP

We can install additional packages by using the Python pip install command. Let’s suppose we want to install the Numpy using PIP. We can do it using the below command.

Syntax: 

pip install numpy

Example 1: When the required package is not installed. 

Using PIP to install a new package

Using Python PIP to install a new package

Example 2: When the required package is already installed. 

Using Python PIP to install an existing package

Using Python PIP to install an existing package

Specifying Package Version using Python PIP

We can also install the package of a specific version by using the below command.

Syntax: 

pip install package_name==version

This will install the package with the specified version

Display Package information using Python PIP

We can use the Python pip show command to display the details of a particular package. 

Syntax: 

pip show numpy

Example: 

Display package information using Python PIP

Display package information using Python PIP

Note: 

  • Requires column shows the dependencies required by the NumPy package
  • Required by shows the packages that require NumPy

Get a list of locally installed Python Modules using Python PIP

The Python pip list command displays a list of packages installed in the system. 

Syntax: 

pip list

Example: 

Getting list of locally installed modules using Python PIP

Getting a list of locally installed modules using Python PIP

Uninstall Packages with Python PIP

The Python pip uninstall command uninstalls a particular existing package. 

Syntax: 

pip uninstall numpy

Example: 

Uninstall package with Python PIP

Uninstall package with Python PIP

Note: The PIP uninstall command does not uninstall the package dependencies. If you want to remove the dependencies as well then you can see the dependencies using the pip show command and remove each package manually.

Search Packages with Python PIP

We can search for a particular existing package using the Python pip search command. 

Syntax: 

pip search numpy

Example: 

Search package with Python PIP

Search package with Python PIP

Using Requirement files with Python PIP

Let’s suppose you want more than one package then instead of installing each package manually, you can install all the modules in a single go. This can be done by creating a requirements.txt file. Let’s suppose the requirements.txt file looks like this:

requirements.txt

requirements.txt

Syntax: 

pip install -r requirements.txt

Example: 

Using requirements file to install packages with Python PIP

Using requirements file to install packages with Python PIP

Listing additional Packages with Python PIP

The Python pip freeze command is used to list packages that don’t come pre-installed with Python. 

Syntax: 

pip freeze

Example: 

Listing additional packages with Python PIP

Listing additional packages with Python PIP

Listing Outdated Packages with Python PIP

Python pip list –outdated command is used to list all the packages that are outdated. This command cross-checks the installed package information with the PIP repository.

Syntax:

pip list --outdated

Example:

Listing outdated packages with Python PIP

Listing outdated packages with Python PIP

Upgrading Packages with Python PIP

Python pip install –user –upgrade is used to update a package.

Syntax:

pip install --user --upgrade package_name

Example:

Upgrading packages with Python PIP

Upgrading packages with Python PIP

Upgrading packages with Python PIP

Upgrading packages with Python PIP

We can also upgrade any package to a specific version using the below command.

pip install --user --upgrade package_name==version

Downgrading Packages with Python PIP

the Python pip install –user command is used to downgrade a package to a specific version.

Syntax:

pip install --user package_name==version

Example:

Downgrading packages with Python PIP

Downgrading packages with Python PIP

Python PIP – FAQ

What is PIP?

PIP stands for “PIP Installs Packages.” It is the package installer for Python, used to download and manage Python packages from the Python Package Index (PyPI) or other package repositories.

How do I install PIP?

PIP is usually installed by default when you install Python. If you have a recent version of Python, you should already have PIP installed. You can check its installation by running pip –version in your command prompt or terminal. If PIP is not installed, you can download the get-pip.py script from the official website and run it to install PIP.

How do I use PIP to install Python packages?

To install a package using PIP, you can use the following command: pip install package_name. Replace package_name with the name of the package you want to install. PIP will automatically download and install the latest version of the package from PyPI.

How do I upgrade a package with PIP?

You can upgrade a package to the latest version using the command: pip install –upgrade package_name. PIP will check for a newer version of the package and install it if available.



Similar Reads

How to install Python libraries without using the pip command?
The most common practice of installing external libraries in your system is by using the Python pip command. However, there is an alternate method of manually installing Python libraries without using the pip command. In this article, we are going to discuss how to manually install a python package. Below is the Step-by-step approach to manually in
1 min read
Linux - Installing PIP to Manage Python Packages
Python is the most popular language for a decade, and we all know that python had a huge support of libraries that are used in different sectors of Software Engineering. Meanwhile, PIP also getting its fame along with python in Linux and developers community.PIP is a package manager for python in handling the software packages that are developed us
2 min read
11 pip Commands For Python Developers
Python has been preferred over all programming languages for technological advancement. It is one of the most lucrative programming languages that is used as the main programming language by more than 80%of developers. It is used for web development, mobile applications, hardware programming, and many more. Pip commands cannot be ignored when we ta
5 min read
Install Packages Using PIP With requirements.txt File in Python
Installing more than one package in Python simultaneously is a common requirement for any user migrating between operating systems. Most users are unaware of the availability of batch installing all the packages. They default to manually installing each library one after the other, which is time-consuming. This article will teach you how to install
2 min read
How to Upgrade Pip and Python on Windows, Linux, and MacOS?
Python is a programming language with standard libraries and a great ecosystem of third-party packages. On the other side, Pip is the default package manager for Python that installs, upgrades and manages Python, including its dependencies. Pip simplifies the process of installing external libraries and tools which are written in Python. Pip allows
5 min read
Upgrade Opencv Using Python PIP
In this article, we will guide you through the step-by-step process of upgrading OpenCV to a specific version using Python PIP. What is Python OpenCV?OpenCV, or Open Source Computer Vision Library, is an open-source software developed by Intel for computer vision, image processing, and machine learning. With versatile tools and functions, it suppor
3 min read
Install Httpx using Python PIP
When working on the internet or building websites, it's important to have good tools to ask for information. HTTPX is one of these tools, and a lot of people like it because it's fast, flexible, and has many features. This article will explain what HTTPX is and show you simple steps to put it on your computer. What is HTTPX?HTTPX is a fully feature
3 min read
Difference Between pip and easy_install in Python
Python's popularity is partly due to its many pre-written code packages that simplify development. Two major tools for managing these packages are pip and easy_install. In this article, we'll look at how they're alike and different, so you can choose the best one for our projects. Python PipPip, the short form of "Pip Installs Packages," is like th
3 min read
How to Install yfinance with Python PIP
The yfinance API is a powerful tool for accessing financial data from Yahoo Finance. It allows users to download historical market data, retrieve financial information, and perform various financial analyses. This API is widely used in finance, investment, and trading applications for its ease of use and comprehensive data coverage. In this article
2 min read
Does Uninstalling a Python Package with "PIP" also Remove the Dependent Packages?
Pip, which stands for "Pip Installs Packages," is the package management system used to install and manage software packages written in Python. These packages are stored in the Python Package Index (PyPI). When you use pip to install a package, it also installs any dependencies required by that package. However, the behavior of pip when it comes to
4 min read
How to fix "error 403 while installing package with Python PIP"?
When working with Python, pip is the go-to tool for managing packages. However, encountering a "403 Forbidden" error can be frustrating. This error typically indicates that the server refuses to fulfill the request, often due to permissions or access restrictions. In this article, we'll delve into the causes of this error and explore various soluti
4 min read
Find Installed Python Package Version Using Pip
When working on Python projects, it’s common to rely on third-party libraries and packages. Knowing which version of a package is installed is crucial, especially when our project depends on specific features or when we need to ensure compatibility with other packages. This article will guide us through several methods to find the version of a pack
2 min read
How to install Python3 and PIP on Godaddy Server?
GoDaddy VPS is a shared server that provides computational services, databases, storage space, automated weekly backups, 99% uptime, and much more. It’s a cheaper alternative to some other popular cloud-based services such as AWS, GPC, and Azure. Python is an open-source, cross-platform, high-level, general-purpose programming language created by G
2 min read
Download and install pip Latest Version
PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “on-line repository” termed as Python Package Index (PyPI). After you have successfully installed Python, you would clearly need pip in order to install packages, such as Numpy, Django and lots more on your
2 min read
How to Force pip to Reinstall a Package?
It is common for library files to get corrupted with time for a programming language. In such cases, it may break the code in inexplicable ways. To resolve such issues, the library files need to be reinstalled a new to fix the problems. Here, we will learn how to force pip to reinstall the current version. There could be two situations in which the
2 min read
Update Flask using PIP
Flask, a popular web framework for Python, evolves with new features, bug fixes, and improvements. Keeping your Flask installation up-to-date ensures that you can leverage the latest enhancements and security patches. In this guide, we'll walk through the process of updating Flask using pip, the package installer for Python. Update Flask Using Pip
2 min read
What is the Difference Between pip and Conda?
Managing packages is a crucial aspect of every project. Python offers several tools for package management, with two of the most popular being pip and conda. While both tools serve the same purpose of installing and managing packages, they have different approaches and functionalities. Understanding the differences between pip and conda can help de
3 min read
"How to Fix 'jupyter: command not found' Error After Installing with pip "
Encountering the "Jupyter command not found" error after installing Jupyter with pip can be frustrating. This common issue typically arises due to problems with the installation path or virtual environments. In this guide, we'll explore the root causes and provide step-by-step solutions to fix this error. Ensuring Jupyter Notebook is correctly inst
4 min read
How to Install Yotta through PIP
Yotta is a powerful tool designed to simplify the management of software projects written in the C and C++ programming languages. It provides a streamlined approach to building automation, dependency management, and package distribution. Whether you're developing embedded systems, IoT devices, or applications that require efficient code management,
3 min read
How to fix "Pip Install Timeout Issue"?
Python's package installer, pip, is an essential tool for managing and installing Python libraries. However, users sometimes encounter a frustrating problem: the "Pip Install Timeout Issue." This issue occurs when pip takes too long to download packages, leading to a timeout error. This article will explain what causes this issue and provide code e
4 min read
How to install pip in macOS ?
Before we start with how to install pip for Python on macOS, let's first go through the basic introduction to Python.  Python is a widely-used general-purpose, high-level programming language. Python is a programming language that lets you work quickly and integrate systems more efficiently. PIP is a package management system used to install and ma
4 min read
How to Upgrade PIP on Windows
In this tutorial, we will see how to Upgrade PIP on Windows. We will cover how to upgrade, check the version, and also how to downgrade PIP to the previous version. What does pip () do?PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “online repository” te
5 min read
How to Install PIP on Windows ?
PIP is a powerful package management system used to install and manage software packages and libraries written in Python. PIP stands for "Preferred Installer Program" or "Pip Installs Packages." To use PIP, you must install Python on your Windows machine. This article provides a step-by-step guide on how to install and configure PIP on Windows, alo
5 min read
Important differences between Python 2.x and Python 3.x with examples
In this article, we will see some important differences between Python 2.x and Python 3.x with the help of some examples. Differences between Python 2.x and Python 3.x Here, we will see the differences in the following libraries and modules: Division operatorprint functionUnicodexrangeError Handling_future_ modulePython Division operatorIf we are p
5 min read
Reading Python File-Like Objects from C | Python
Writing C extension code that consumes data from any Python file-like object (e.g., normal files, StringIO objects, etc.). read() method has to be repeatedly invoke to consume data on a file-like object and take steps to properly decode the resulting data. Given below is a C extension function that merely consumes all of the data on a file-like obj
3 min read
Python | Add Logging to a Python Script
In this article, we will learn how to have scripts and simple programs to write diagnostic information to log files. Code #1 : Using the logging module to add logging to a simple program import logging def main(): # Configure the logging system logging.basicConfig(filename ='app.log', level = logging.ERROR) # Variables (to make the calls that follo
2 min read
Python | Add Logging to Python Libraries
In this article, we will learn how to add a logging capability to a library, but don’t want it to interfere with programs that don’t use logging. For libraries that want to perform logging, create a dedicated logger object, and initially configure it as shown in the code below - Code #1 : C/C++ Code # abc.py import logging log = logging.getLogger(_
2 min read
Python | Index of Non-Zero elements in Python list
Sometimes, while working with python list, we can have a problem in which we need to find positions of all the integers other than 0. This can have application in day-day programming or competitive programming. Let's discuss a shorthand by which we can perform this particular task. Method : Using enumerate() + list comprehension This method can be
6 min read
MySQL-Connector-Python module in Python
MySQL is a Relational Database Management System (RDBMS) whereas the structured Query Language (SQL) is the language used for handling the RDBMS using commands i.e Creating, Inserting, Updating and Deleting the data from the databases. SQL commands are case insensitive i.e CREATE and create signify the same command. In this article, we will be disc
2 min read
Python - Read blob object in python using wand library
BLOB stands for Binary Large OBject. A blob is a data type that can store binary data. This is different than most other data types used in databases, such as integers, floating point numbers, characters, and strings, which store letters and numbers. BLOB is a large complex collection of binary data which is stored in Database. Basically BLOB is us
2 min read
Article Tags :
Practice Tags :