What's the difference between `pipenv install` and `pipenv lock`?

4k Views Asked by At

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?

2

There are 2 best solutions below

2
On BEST ANSWER

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

0
On

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.