Pip (package manager) explained

pip
Author:Ian Bicking
Released:[1]
Programming Language:Python
Operating System:OS-independent
Platform:Python
Genre:Package management system
License:MIT[2]

pip (also known by Python 3's alias pip3) is a package-management system written in Python and is used to install and manage software packages.[3] The Python Software Foundation recommends using pip for installing Python applications and its dependencies during deployment.[4] Pip connects to an online repository of public packages, called the Python Package Index. Pip can be configured to connect to other package repositories (local or remote), provided that they comply to Python Enhancement Proposal 503.[5] [6]

Most distributions of Python come with pip preinstalled. Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default.[7]

History

First introduced as pyinstall in 2008 by Ian Bicking (the creator of the virtualenv package) as an alternative to easy install,[8] [9] pip was chosen as the new name from one of several suggestions that the creator received on his blog post.[10] According to Bicking himself, the name is a recursive acronym for "Pip Installs Packages".[11] In 2011, the Python Packaging Authority (PyPA) was created to take over the maintenance of pip and virtualenv from Bicking, led by Carl Meyer, Brian Rosner, and Jannis Leidel.

With the release of pip version 6.0 (2014-12-22), the version naming process was changed to have version in X.Y format and drop the preceding 1 from the version label.[12]

Command-line interface

Pip's command-line interface allows the install of Python software packages by issuing a command: pip install some-package-name

Users can also remove the package by issuing a command: pip uninstall some-package-name

pip has a feature to manage full lists of packages and corresponding version numbers, possible through a "requirements" file.[13] This permits the efficient re-creation of an entire group of packages in a separate environment (e.g. another computer) or virtual environment. This can be achieved with a properly formatted file and the following command,[14] where requirements.txt is the name of the file: pip install -r requirements.txt.

To install some package for a specific python version, pip provides the following command, where ${version} is replaced by 2, 3, 3.4, etc.: pip${version} install some-package-name.

Using

Pip provides a way to install user-defined projects locally with the use of file. This method requires the python project to have the following file structure: example_project/ ├── exampleproject/ Python package with source code. | ├── __init__.py Make the folder a package. |  └── example.py Example module. └── README.md README with info of the project.Within this structure, user can add to the root of the project (i.e. for above structure) with the following content:from setuptools import setup, find_packages

setup(name='example', # Name of the package. This will be used, when the project is imported as a package. version='0.1.0', packages=find_packages(include=['exampleproject', 'exampleproject.*']) # Pip will automatically install the dependencies provided here.)After this, pip can install this custom project by running the following command, from the project root directory: pip install -e.

Custom repository

Besides the default PyPI repository, Pip supports custom repositories as well.[15] Such repositories can be located on an HTTP(s) URL or on a file system location.

A custom repository can be specified using the -i or—index-url option, like so: pip install -i <nowiki>https://your-custom-repo/simple</nowiki> <package name>; or with a filesystem: pip install -i /path/to/your/custom-repo/simple <package name>.

See also

External links

Notes and References

  1. Web site: Release 1.0 . . 4 March 2020 . 17 September 2021 . https://web.archive.org/web/20210917180846/https://github.com/pypa/pip/releases/tag/1.0 . live .
  2. Web site: pip/LICENSE.txt . 17 April 2018 . Github . 1 June 2018 . https://web.archive.org/web/20180601113651/https://github.com/pypa/pip/blob/master/LICENSE.txt . 1 June 2018 . live.
  3. Web site: Kollár . László . Managing Python packages the right way . 23 June 2019 . Opensource.com . . en.
  4. Web site: Tool recommendations — Python Packaging User Guide . 2022-11-09 . packaging.python.org.
  5. Web site: Python Enhancement Proposal 503 . python.org.
  6. Web site: pip install command line documentation . pip.pypa.io.
  7. Web site: pip installation . 24 Feb 2015.
  8. Web site: Bicking . Ian . 24 September 2008 . pyinstall: A New Hope . https://web.archive.org/web/20080927034025/http://www.openplans.org/projects/topp-engineering/blog/2008/09/24/pyinstall-a-new-hope/ . 27 September 2008 . 4 March 2020.
  9. Web site: Packaging History . 4 March 2020 . Python Packaging Authority.
  10. Web site: Bicking . Ian . 1 October 2008 . pyinstall pybundles . 24 November 2021.
  11. Web site: Bicking . Ian . 28 October 2008 . pyinstall is dead, long live pip! . 24 November 2021.
  12. Web site: Changelog - pip documentation v22.3.1 .
  13. Web site: pip documentation . 5 January 2012 . The pip developers.
  14. Web site: Gahlot . Gaurav . 6 November 2018 . Most Important pip Commands for a Python Developer - DZone Open Source . 23 June 2019 . dzone.com . en.
  15. Web site: Custom repository with pip install -i . 12 Jan 2022.