pipenvpipenv-install

"pipenv install" in empty directory doesn't create a Pipfile, but uses a Pipfile.lock from somewhere else


I ran pipenv install to create a Pipfile in the current directory that doesn't have a Pipfile. It gave the following output but did not create a Pipfile. Why not?

Installing dependencies from Pipfile.lock (639627)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

It looks like it found a Pipfile.lock somewhere and used it? (similar to git behavior)


Solution

  • Use the PIPENV_NO_INHERIT environment variable to ignore inheriting from directories above the current directory, e.g.,

    PIPENV_NO_INHERIT=True pipenv install
    

    In your case, pipenv searched directories above the current directory and found a Pipfile there that it used (the location of which can be seen with pipenv --where).

    (Incidently, I looked at the pipenv documentation but was unable to find where it discussed this behavior, so please add a link here to that documentation if you find it.)