Pipenv: Python Dev Workflow for Humans¶
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. Windows is a first-class citizen, in our world.
It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile
as you install/uninstall packages. It also generates the ever-important Pipfile.lock
, which is used to produce deterministic builds.
Pipenv is primarily meant to provide users and developers of applications with an easy method to setup a working environment. For the distinction between libraries and applications and the usage of setup.py
vs Pipfile
to define dependencies, see ☤ Pipfile vs setup.py.

The problems that Pipenv seeks to solve are multi-faceted:
You no longer need to use
pip
andvirtualenv
separately. They work together.Managing a
requirements.txt
file can be problematic, so Pipenv usesPipfile
andPipfile.lock
to separate abstract dependency declarations from the last tested combination.Hashes are used everywhere, always. Security. Automatically expose security vulnerabilities.
Strongly encourage the use of the latest versions of dependencies to minimize security risks arising from outdated components.
Give you insight into your dependency graph (e.g.
$ pipenv graph
).Streamline development workflow by loading
.env
files.
You can quickly play with Pipenv right in your browser:
Install Pipenv Today!¶
The recommended way to install pipenv on most platforms is to install from pypi using pip
:
$ pip install --user pipenv
Or, if you’re using Fedora 28:
$ sudo dnf install pipenv
More detailed installation instructions can be found in the ☤ Installing Pipenv chapter.
✨🍰✨
Pipenv Features¶
Enables truly deterministic builds, while easily specifying only what you want.
Generates and checks file hashes for locked dependencies when installing from
Pipfile.lock
.Automatically install required Python version when
pyenv
is available.Automatically finds your project home, recursively, by looking for a
Pipfile
.Automatically generates a
Pipfile
, if one doesn’t exist.Automatically creates a virtualenv in a standard customizable location.
Automatically adds/removes packages to a
Pipfile
when they are installed or uninstalled.Automatically loads
.env
files to support customization and overrides.
Basic Commands and Concepts¶
Pipenv uses a set of commands to manage your Project’s dependencies and custom scripts.
It replaces the use of Makefile
, direct calls to pip
and python -m venv
or virtualenv
.
to create virtual environments and install packages in them.
Pipenv uses two files to do this: Pipfile
and Pipfile.lock
(which will look familiar if you
are used to packages manager like yarn
or npm
).
The main commands are:
install
-Will create a virtual env and install dependencies (if it does not exist already) The dependencies will be installed inside.
install package==0.2
-Will add the package in version 0.2 to the virtual environment and to
Pipfile
andPipfile.lock
uninstall
- Will remove the dependencylock
- RegeneratePipfile.lock
and updates the dependencies inside it.
These are intended to replace $ pip install
usage, as well as manual virtualenv management.
Other Commands¶
graph
will show you a dependency graph of your installed dependencies.shell
will spawn a shell with the virtualenv activated. This shell can be deactivated by usingexit
.run
will run a given command from the virtualenv, with any arguments forwarded (e.g.$ pipenv run python
or$ pipenv run pip freeze
).check
checks for security vulnerabilities and asserts that PEP 508 requirements are being met by the current environment.
Further Documentation Guides¶
- Pipenv & Virtual Environments
- Basic Usage of Pipenv
- ☤ Example Pipfile & Pipfile.lock
- ☤ General Recommendations & Version Control
- ☤ Example Pipenv Workflow
- ☤ Example Pipenv Upgrade Workflow
- ☤ Importing from requirements.txt
- ☤ Specifying Versions of a Package
- ☤ Specifying Versions of Python
- ☤ Editable Dependencies (e.g.
-e .
) - ☤ Specifying Package Categories
- ☤ Environment Management with Pipenv
- ☤ About Shell Configuration
- ☤ A Note about VCS Dependencies
- ☤ Pipfile.lock Security Features
- ☤ Pipenv and Docker Containers
- Advanced Usage of Pipenv
- ☤ Caveats
- ☤ Specifying Package Indexes
- ☤ Using a PyPI Mirror
- ☤ Injecting credentials into Pipfile via environment variables
- ☤ Injecting credentials through keychain support
- ☤ Supplying additional arguments to pip
- ☤ Specifying Basically Anything
- ☤ Using pipenv for Deployments
- ☤ Pipenv and Other Python Distributions
- ☤ Generating a
requirements.txt
- ☤ Detection of Security Vulnerabilities
- ☤ Community Integrations
- ☤ Open a Module in Your Editor
- ☤ Automatic Python Installation
- ☤ Automatic Loading of
.env
- ☤ Custom Script Shortcuts
- ☤ Configuration With Environment Variables
- ☤ Custom Virtual Environment Location
- ☤ Virtual Environment Name
- ☤ Testing Projects
- ☤ Shell Completion
- ☤ Working with Platform-Provided Python Components
- ☤ Pipfile vs setup.py
- ☤ Changing Pipenv’s Cache Location
- ☤ Changing Default Python Versions
- Pipenv CLI Reference
- Frequently Encountered Pipenv Problems
- ☤ Your dependencies could not be resolved
- ☤ No module named <module name>
- ☤ My pyenv-installed Python is not found
- ☤ Pipenv does not respect pyenv’s global and local Python versions
- ☤ ValueError: unknown locale: UTF-8
- ☤ /bin/pip: No such file or directory
- ☤ Pipenv does not respect dependencies in setup.py
- ☤ Using
pipenv run
in Supervisor program - ☤ An exception is raised during
Locking dependencies...
- Release and Version History
- 2022.12.19 (2022-12-19)
- Pipenv 2022.12.19 (2022-12-19)
- 2022.12.17 (2022-12-17)
- Pipenv 2022.12.17 (2022-12-17)
- 2022.11.30 (2022-11-30)
- Pipenv 2022.11.30 (2022-11-30)
- 2022.11.25 (2022-11-24)
- Pipenv 2022.11.25 (2022-11-24)
- 2022.11.24 (2022-11-24)
- Pipenv 2022.11.24 (2022-11-24)
- 2022.11.23 (2022-11-23)
- Pipenv 2022.11.23 (2022-11-23)
- 2022.11.11 (2022-11-11)
- Pipenv 2022.11.11 (2022-11-11)
- 2022.11.5 (2022-11-05)
- Pipenv 2022.11.5 (2022-11-05)
- 2022.11.4 (2022-11-04)
- Pipenv 2022.11.4 (2022-11-04)
- 2022.10.25 (2022-10-25)
- Pipenv 2022.10.25 (2022-10-25)
- 2022.10.12 (2022-10-12)
- Pipenv 2022.10.12 (2022-10-12)
- 2022.10.11 (2022-10-11)
- Pipenv 2022.10.11 (2022-10-11)
- 2022.10.10 (2022-10-10)
- Pipenv 2022.10.10 (2022-10-10)
- 2022.10.9 (2022-10-09)
- Pipenv 2022.10.9 (2022-10-09)
- 2022.10.4 (2022-10-04)
- Pipenv 2022.10.4 (2022-10-04)
- 2022.9.24 (2022-09-24)
- Pipenv 2022.9.24 (2022-09-24)
- 2022.9.21 (2022-09-21)
- Pipenv 2022.9.21 (2022-09-21)
- 2022.9.20 (2022-09-20)
- Pipenv 2022.9.20 (2022-09-20)
- 2022.9.8 (2022-09-08)
- Pipenv 2022.9.8 (2022-09-08)
- 2022.9.4 (2022-09-04)
- 2022.9.2 (2022-09-02)
- 2022.8.31 (2022-08-31)
- 2022.8.30 (2022-08-30)
- 2022.8.24 (2022-08-24)
- 2022.8.19 (2022-08-19)
- 2022.8.17 (2022-08-17)
- 2022.8.15 (2022-08-15)
- 2022.8.14 (2022-08-14)
- 2022.8.13 (2022-08-13)
- 2022.8.5 (2022-08-05)
- 2022.7.24 (2022-07-24)
- 2022.7.4 (2022-07-04)
- 2022.5.3.dev0 (2022-06-07)
- 2022.5.2 (2022-05-02)
- 2022.4.30 (2022-04-30)
- 2022.4.21 (2022-04-21)
- 2022.4.20 (2022-04-20)
- 2022.4.8 (2022-04-08)
- 2022.3.28 (2022-03-27)
- 2022.3.24 (2022-03-23)
- 2022.3.23 (2022-03-22)
- 2022.1.8 (2022-01-08)
- 2021.11.23 (2021-11-23)
- 2021.11.15 (2021-11-15)
- 2021.11.9 (2021-11-09)
- 2021.11.5.post0 (2021-11-05)
- 2021.11.5 (2021-11-05)
- 2021.5.29 (2021-05-29)
- 2020.11.15 (2020-11-15)
- 2020.11.4 (2020-11-04)
- 2020.8.13 (2020-08-13)
- 2020.6.2 (2020-06-02)
- 2020.5.28 (2020-05-28)
- 2018.11.26 (2018-11-26)
- 2018.11.14 (2018-11-14)
- 2018.10.13 (2018-10-13)
- 2018.10.9 (2018-10-09)
- 2018.7.1 (2018-07-01)
- 2018.6.25 (2018-06-25)