Pipfile.lock

Raise code
sequential=False,
pypi_mirror=None,
system=False,
deploy=False,
):
# The lock file needs to exist because sync won't write to it.
if not project.lockfile_exists:
raise exceptions.LockfileNotFound("Pipfile.lock")
# Ensure that virtualenv is available if not system.
ensure_project(
three=three,
python=python,
validate=False,
deploy=deploy,
Links to the raise (1)
https://github.com/pypa/pipenv/blob/e7fb099e659a7fe661f0be9d4b1d05b681b6d562/pipenv/core.py#L2869Ways to fix
When you work with pipenv, both Pipfile and Pipfile.lock should exsit in a directory where you execute pipenv sync command.
Let's create an empty project:
mkdir tmp cd tmp/ pipenv --python 3.6
Lets check all files which were created:
$ ls Pipfile
So if there were no packages installed, only one Pipfile exists which has meta ifo about a project only:
If you will try to run pipenv sync at this point, you will already see an exception:
ERROR: Pipfile.lock not found! You need to run $ pipenv lock before you can continue.
Actually, the sync command installs all locked packages. But now we have no packages at all so exception makes sense! Let's install the first package into our pipenv:
pipenv install requests
Now we have two files:
$ ls PipfileΒ Pipfile.lock
And if you will run pipenv sync, the request package will be just reinstalled successfully:
$ pipenv sync Installing dependencies from Pipfile.lock (b14837)... Β πΒ Β ββββββββββββββββββββββββββββββββ 0/0 β 00:00:00 To activate this project's virtualenv, run pipenv shell. Alternatively, run a command inside the virtualenv with pipenv run. All dependencies are now up-to-date!
But once you remove Pipfile.lock file with:
rm Pipfile.lock
and then try sync again, an exception will return,
To fix it, if lock file was deleted, just run:
pipenv install
So, main reasons why the exception happens:
- You or repository creator did not commit Pipfile.lock to the repository
- You or some removed Pipfile.lock
- You are trying to run sync command on a fresh project without packages which makes no sense
In the last case, you might need to read basics about how to use pipenv