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"
To explicitly disable a boolean option, assign to it a false value (i.e.
- class pipenv.environments.Setting¶
Control various settings of pipenv via environment variables.
Location for Pipenv to store it’s package cache. Default is to use appdir’s user cache directory.
Tells Pipenv whether to name the venv something other than the default dir name.
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.
If set, Pipenv does not load the
Default is to load
If set, Pipenv does not attempt to install Python with asdf.
Default is to install Python automatically via asdf when needed, if possible.
If set, Pipenv does not attempt to install Python with pyenv.
Default is to install Python automatically via pyenv when needed, if possible.
If set, Pipenv loads the
.envfile at the specified location.
Default is to load
.envfrom the project root, if found.
If set, the terminal emulator’s name for
pipenv shellto use.
Default is to detect emulators automatically. This should be set if your emulator, e.g. Cmder, cannot be detected correctly.
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.
Max number of seconds to wait for package installation.
Defaults to 900 (15 minutes), a very long arbitrary time.
Maximum number of directories to recursively search for a Pipfile.
Default is 3. See also
Specify how many retries Pipenv should attempt for network requests.
Default is 0. Automatically set to 1 on CI environments for robust testing.
If set, disable terminal spinner.
This can make the logs cleaner. Automatically set on Windows, and in CI environments.
Tell Pipenv not to inherit parent directories.
This is useful for deployment to avoid using the wrong current directory. Overwrites
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
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-mirrorcommand line flag overwrites this.
If set, makes Pipenv quieter.
Default is unset, for normal verbosity.
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).
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.
An absolute path to the preferred shell for
Default is to detect automatically what shell is currently in use.
If set, always use fancy mode when invoking
Default is to use the compatibility shell if possible.
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.lockon each run.
Usage: export PIPENV_SKIP_LOCK=true OR export PIPENV_SKIP_LOCK=1 to skip automatic locking
NOTE: This only affects the
Max number of seconds Pipenv will wait for virtualenv creation to complete.
Default is 120 seconds, an arbitrary number that seems to work.
When set True, will create or use the
.venvin 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.
If set, makes Pipenv more wordy.
Default is unset, for normal verbosity. This takes precedence over
Tells Pipenv to use the virtualenv –copies to prevent symlinks when specified as Truthy.
Tells Pipenv to use the virtualenv –creator= argument with the user specified value.
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.
Specifies the value for pip’s –exists-action option
Use the default Python
Also note that
pip supports additional environment variables, if you need additional customization.
$ 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.
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.