Rob Bednark
Rob Bednark

Reputation: 28122

"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)

Upvotes: 2

Views: 1729

Answers (2)

Fuad Palchayev
Fuad Palchayev

Reputation: 57

I ran pipenv shell first (creat Pipfile), then pipenv install (creat Pipfile.lock)

'pip install pipenv' command returns "Requirement already satisfied ..."

Upvotes: 0

Rob Bednark
Rob Bednark

Reputation: 28122

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.)

Upvotes: 5

Related Questions