pip module manages Python packages using pip, compatible with both global installations and virtualenvs.
Functions
packages
Install, remove, or update pip packages.str | list[str]
List of packages to ensure.
bool
default:true
Whether the packages should be installed.
bool
default:false
Whether to upgrade packages without a specified version.
str
Location of requirements file to install/uninstall.
str
default:"pip"
Name or path of the pip directory to use.
str
Root directory of virtualenv to work in.
dict
Dictionary of arguments to pass to
pip.virtualenv.str
Additional arguments to the pip install command.
Package versions can be pinned like pip:
<pkg>==<version>If a virtualenv is specified, it will be created if it doesn’t exist.
virtualenv_kwargs can control how the env is created.Examples
virtualenv
Create or remove Python virtualenvs.str
required
Path where the virtualenv should be created.
str
Python interpreter to use.
bool
default:false
Use standard venv module instead of virtualenv.
bool
default:false
Give access to the global site-packages.
bool
default:false
Always copy files rather than symlinking.
bool
default:true
Whether the virtualenv should exist.
Examples
venv
Create or remove Python virtualenvs using the standard venv module.str
required
Path where the venv should be created.
str
Python interpreter to use.
bool
default:false
Give access to the global site-packages.
bool
default:false
Always copy files rather than symlinking.
bool
default:true
Whether the venv should exist.
This is a convenience wrapper around
pip.virtualenv with venv=True.Common Use Cases
Django Application Setup
Data Science Environment
Development Environment
Global Tool Installation
Pinned Versions for Production
Using Custom PyPI Index
Python Package Management Tips
Requirements Files
Requirements Files
Best practices for requirements files:
Upgrading Packages
Upgrading Packages
Use the
latest flag to upgrade packages:Editable Installs
Editable Installs
Install packages in development mode:
Combining with System Packages
Combining with System Packages
Access system packages from virtualenv:
Using Different Python Versions
Using Different Python Versions
Create virtualenvs with specific Python versions:
Important Notes
Package names are compared using lowercase as per PEP-0426.
