Given that a Pipfile exists, it seems that both would install all dependencies from the Pipfile, and update Pipfile.lock. So, what is the difference?
-
1`pipenv lock` *doesn't* (I think) install any dependencies. It simply generates `Pipfile.lock` from your `Pipfile`. – chepner Nov 29 '18 at 18:49
2 Answers
pipenv lock
generates a consistent set of dependencies from Pipfile
and writes that to Pipfile.lock
. It doesn't change the installed packages.
pipenv install
with no arguments would generate the same set of dependencies and install them into the virtualenv.
I find the Pipenv documentation unclear.

- 2,467
- 1
- 19
- 24
You can have the details in the documentation: https://pipenv.readthedocs.io/en/latest/basics
Basically pipenv install
installs all the packages in the environment, whereas pipenv lock
creates the pipenv.lock file depending on what is already installed (even if you initialized your environment with a requirements.txt file using pip)
If your folder is empty the effect will indeed be the same: the initialization of a pipenv environment with the default packages

- 488
- 4
- 9
-
Ok, I see where I got confused. When you add a dependency to Pipfile and then run Pipfile.lock, this dependency propagates to Pipfile.lock. I thought, it means that it actually gets installed. But it doesn't. Which, IMHO, is a strange behavior. I end up with a package in Pipfile and in Pipfile.lock but not in the system. – Konstantin Nov 29 '18 at 19:03
-
I downvoted because that is not what I find happens. I see what @chepner said: it generates `Pipfile.lock` from `Pipfile` but wihout installing dependencies. – wrgrs Jul 05 '19 at 13:13