pip is a package manager designated for managing Python packages. It is a command-line tool that facilitates the installation of third-party packages along with their dependencies.

Python comes with standalone libraries that are included in the Python installation.

However, there are instances where you need to install third-party packages, which are essentially reusable code shipped as a single file. These packages include dependencies and configurations, enhancing the functionality of Python code.

In your project, the pip tool is utilized for installing, uninstalling, upgrading, and listing packages.

What does Pip do?

With the PIP tool, you can perform various tasks:

  • Install and Uninstall Packages PIP allows you to install and uninstall packages from different repositories, such as the Python Package Index (PyPI) or GitHub repositories. The repository must be accessible via either HTTP or HTTPS.

  • package Dependences PIP enables the definition of project dependencies through a requirements.txt file. This file allows you to install and uninstall packages based on their specifications. Additionally, PIP automatically downloads package dependencies during installation.

  • Upgrade Packages to Specific or Latest Versions You have the flexibility to upgrade packages to specific versions or the latest available versions.

  • Installed Package List and Package Information The pip list command displays all installed packages, while the pip show command provides detailed package metadata.

  • Find outdated old packages report PIP lists all outdated versions used in the project, presenting both the current and latest versions.

  • Create and manage virtual environment Virtual environments are independent Python environments for running multiple projects. Each project has its dependencies, avoiding conflicts with other projects.

  • Requirement files A requirements.txt file is a text file containing a list of packages to be installed in your project. This file allows the installation of multiple packages with specific versions, aiding in cloning and shipping projects to different environments. It also streamlines the installation process by preventing the need for multiple commands.

PIP is an important tool for the development of apps in Python

Check if the pip is installed

You can check pip is installed using the --version option in the terminal

E:>pip –version pip 23.2.1 from C:\Python312\Lib\site-packages\pip (python 3.12)

It gives pip and python versions along with location.

PIP community packages list

Typically, PIP packages are hosted on pypi.org .

There are two types of users:

  • Publisher These are community members or users who create Python code and package it for distribution. They publish their packages to the PyPI source, making their reusable code available for distribution and sharing. This process is facilitated using the pip tool.

  • Consumer Consumers are users working on applications. They specify dependencies along with versions and use the pip tool to install them. The tool downloads packages from PyPI and installs them in the project. If a published version changes, pip commands check for the latest version and upgrade to the new version by downloading the updated package.

Additionally, the pip tool allows you to uninstall packages.

Reference