Pip is a
package-management system written in
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
and is used to install and manage
software packages.
The
Python Software Foundation
The Python Software Foundation (PSF) is an American nonprofit organization devoted to the Python programming language, launched on March 6, 2001. The mission of the foundation is to foster development of the Python community and is responsible for ...
recommends using pip for installing Python applications and its dependencies during deployment. Pip connects to an
online repository of public packages, called the
Python Package Index
The Python Package Index, abbreviated as PyPI () and also known as the Cheese Shop (a reference to the ''Monty Python's Flying Circus'' sketch " Cheese Shop"), is the official third-party software repository for Python. It is analogous to the C ...
. Pip can be configured to connect to other package repositories (local or remote), provided that they comply to
Python Enhancement Proposal
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Python is dynamically-typed and garbage-collected. It supports multiple programming par ...
503.
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.
History
First introduced as pyinstall in 2008 by Ian Bicking (the creator of the virtualenv package) as an alternative to
easy install
setuptools is a package development process library designed to facilitate packaging Python projects by enhancing the Python standard library (distribution utilities). It includes:
*Python package and module definitions
*Distribution package me ...
,
pip was chosen as the new name from one of several suggestions that the creator received on his blog post. According to Bicking himself, the name is a
recursive acronym
A recursive acronym is an acronym that refers to itself, and appears most frequently in computer programming. The term was first used in print in 1979 in Douglas Hofstadter's book '' Gödel, Escher, Bach: An Eternal Golden Braid'', in which Hof ...
for "Pip Installs Packages". 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.
Command-line interface
Pip's
command-line interface
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
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.
This permits the efficient re-creation of an entire group of packages in a separate environment (e.g. another computer) or
virtual environment
A virtual environment is a networked application that allows a user to interact with both the computing environment and the work of other users. Email
Electronic mail (email or e-mail) is a method of exchanging messages ("mail") betwee ...
. This can be achieved with a properly formatted file and the following command,
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
$
is replaced by 2, 3, 3.4, etc.:
pip$ 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.
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 https://your-custom-repo/simple
Or with a filesystem:
pip install -i /path/to/your/custom-repo/simple
See also
*
Setuptools
PipenvPython Poetry*
Conda (package manager)
Conda is an open-source,
cross-platform,
language-agnostic package manager and environment management system. It was originally developed to solve difficult package management challenges faced by Python data scientists, and today is a popula ...
for
Anaconda
Anacondas or water boas are a group of large snakes of the genus '' Eunectes''. They are found in tropical South America. Four species are currently recognized.
Description
Although the name applies to a group of snakes, it is often used ...
distribution
*
PyPM -
ActiveState
ActiveState Software Inc is a Canadian software company headquartered in Vancouver, British Columbia. It develops, sells, and supports cross-platform development tools for dynamic languages such as Perl, PHP, Python, Ruby, and Tcl, as well ...
's proprietary package manager
References
External links
Official Pip websitePython Packaging Authority
{{Package management systems
Free package management systems
Python (programming language) development tools
Python (programming language) software