Configuration

Configuration With Environment Variables

Pipenv comes with a handful of options that can be set via shell environment variables.

To enable boolean options, create the variable in your shell and assign to it a true value. Allowed values are: "1", "true", "yes", "on"

$ PIPENV_IGNORE_VIRTUALENVS=1

To explicitly disable a boolean option, assign to it a false value (i.e. "0").

class pipenv.environments.Setting[source]

Control various settings of pipenv via environment variables.

PIPENV_CACHE_DIR

Location for Pipenv to store it’s package cache. Default is to use appdir’s user cache directory.

PIPENV_CUSTOM_VENV_NAME

Tells Pipenv whether to name the venv something other than the default dir name.

PIPENV_DEFAULT_PYTHON_VERSION

Use this Python version when creating new virtual environments by default.

This can be set to a version string, e.g. 3.9, or a path. Default is to use whatever Python Pipenv is installed under (i.e. sys.executable). Command line flags (e.g. --python) are prioritized over this configuration.

PIPENV_DONT_LOAD_ENV

If set, Pipenv does not load the .env file.

Default is to load .env for run and shell commands.

PIPENV_DONT_USE_ASDF

If set, Pipenv does not attempt to install Python with asdf.

Default is to install Python automatically via asdf when needed, if possible.

PIPENV_DONT_USE_PYENV

If set, Pipenv does not attempt to install Python with pyenv.

Default is to install Python automatically via pyenv when needed, if possible.

PIPENV_DOTENV_LOCATION

If set, Pipenv loads the .env file at the specified location.

Default is to load .env from the project root, if found.

PIPENV_EMULATOR

If set, the terminal emulator’s name for pipenv shell to use.

Default is to detect emulators automatically. This should be set if your emulator, e.g. Cmder, cannot be detected correctly.

PIPENV_IGNORE_VIRTUALENVS

If set, Pipenv will always assign a virtual environment for this project.

By default, Pipenv tries to detect whether it is run inside a virtual environment, and reuses it if possible. This is usually the desired behavior, and enables the user to use any user-built environments with Pipenv.

PIPENV_INSTALL_TIMEOUT

Max number of seconds to wait for package installation.

Defaults to 900 (15 minutes), a very long arbitrary time.

PIPENV_MAX_DEPTH

Maximum number of directories to recursively search for a Pipfile.

Default is 3. See also PIPENV_NO_INHERIT.

PIPENV_MAX_RETRIES

Specify how many retries Pipenv should attempt for network requests.

Default is 0. Automatically set to 1 on CI environments for robust testing.

PIPENV_NOSPIN

If set, disable terminal spinner.

This can make the logs cleaner. Automatically set on Windows, and in CI environments.

PIPENV_NO_INHERIT

Tell Pipenv not to inherit parent directories.

This is useful for deployment to avoid using the wrong current directory. Overwrites PIPENV_MAX_DEPTH.

PIPENV_PIPFILE

If set, this specifies a custom Pipfile location.

When running pipenv from a location other than the same directory where the Pipfile is located, instruct pipenv to find the Pipfile in the location specified by this environment variable.

Default is to find Pipfile automatically in the current and parent directories. See also PIPENV_MAX_DEPTH.

PIPENV_PYPI_MIRROR

If set, tells pipenv to override PyPI index urls with a mirror.

Default is to not mirror PyPI, i.e. use the real one, pypi.org. The --pypi-mirror command line flag overwrites this.

PIPENV_QUIET

If set, makes Pipenv quieter.

Default is unset, for normal verbosity. PIPENV_VERBOSE overrides this.

PIPENV_REQUESTS_TIMEOUT

Timeout setting for requests.

Default is 10 seconds.

For more information on the role of Timeout in Requests, see [Requests docs](https://requests.readthedocs.io/en/latest/user/advanced/#timeouts).

PIPENV_RESOLVE_VCS

Tells Pipenv whether to resolve all VCS dependencies in full.

As of Pipenv 2018.11.26, only editable VCS dependencies were resolved in full. To retain this behavior and avoid handling any conflicts that arise from the new approach, you may disable this.

PIPENV_SHELL_EXPLICIT

An absolute path to the preferred shell for pipenv shell.

Default is to detect automatically what shell is currently in use.

PIPENV_SHELL_FANCY

If set, always use fancy mode when invoking pipenv shell.

Default is to use the compatibility shell if possible.

PIPENV_SKIP_LOCK

If set, Pipenv won’t lock dependencies automatically.

This might be desirable if a project has large number of dependencies, because locking is an inherently slow operation.

Default is to lock dependencies and update Pipfile.lock on each run.

Usage: export PIPENV_SKIP_LOCK=true OR export PIPENV_SKIP_LOCK=1 to skip automatic locking

NOTE: This only affects the install and uninstall commands.

PIPENV_TIMEOUT

Max number of seconds Pipenv will wait for virtualenv creation to complete.

Default is 120 seconds, an arbitrary number that seems to work.

PIPENV_VENV_IN_PROJECT

When set True, will create or use the .venv in your project directory. When Set False, will ignore the .venv in your project directory even if it exists. If unset (default), will use the .venv of project directory should it exist, otherwise will create new virtual environments in a global location.

PIPENV_VERBOSE

If set, makes Pipenv more wordy.

Default is unset, for normal verbosity. This takes precedence over PIPENV_QUIET.

PIPENV_VIRTUALENV_COPIES

Tells Pipenv to use the virtualenv –copies to prevent symlinks when specified as Truthy.

PIPENV_VIRTUALENV_CREATOR

Tells Pipenv to use the virtualenv –creator= argument with the user specified value.

PIPENV_YES

If set, Pipenv automatically assumes “yes” at all prompts.

Default is to prompt the user for an answer if the current command line session if interactive.

PIP_EXISTS_ACTION

Specifies the value for pip’s –exists-action option

Defaults to (w)ipe

USING_DEFAULT_PYTHON

Use the default Python

Also note that pip supports additional environment variables, if you need additional customization.

For example:

$ PIP_INSTALL_OPTION="-- -DCMAKE_BUILD_TYPE=Release" pipenv install -e .

Changing Cache Location

You can force pipenv to use a different cache location by setting the environment variable PIPENV_CACHE_DIR to the location you wish. This is useful in the same situations that you would change PIP_CACHE_DIR to a different directory.

Changing Default Python Versions

By default, pipenv will initialize a project using whatever version of python the system has as default. Besides starting a project with the --python flag, you can also use PIPENV_DEFAULT_PYTHON_VERSION to specify what version to use when starting a project when --python isn’t used.

Environments with network issues

If you are trying to use pipenv in an environment with network issues, you may be able to try modifying the following settings when you encounter errors related to network connectivity.

REQUESTS_TIMEOUT

Default is 10 seconds. You can increase it by setting PIPENV_REQUESTS_TIMEOUT environment variable.

Please notice that this setting only affects pipenv itself, not additional packages such as safety.