diff --git a/news/5334.bugfix.rst b/news/5334.bugfix.rst new file mode 100644 index 0000000000..719fbe34b6 --- /dev/null +++ b/news/5334.bugfix.rst @@ -0,0 +1 @@ +Load the dot env earlier so that ``PIPENV_CUSTOM_VENV_NAME`` is more useful across projects. diff --git a/pipenv/core.py b/pipenv/core.py index 4b5ad405ab..f6d012b620 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -2731,6 +2731,9 @@ def do_run( """ from .cmdparse import ScriptEmptyError + load_dot_env(project, quiet=quiet) + env = os.environ.copy() + # Ensure that virtualenv is available. ensure_project( project, @@ -2740,9 +2743,6 @@ def do_run( pypi_mirror=pypi_mirror, ) - load_dot_env(project, quiet=quiet) - env = os.environ.copy() - path = env.get("PATH", "") if project.virtualenv_location: new_path = os.path.join(