Skip to content
Latchkey

Pipenv "Locking Failed!" - Fix Pipfile.lock Resolution in CI

Pipenv could not resolve a consistent set of versions from your Pipfile, so locking failed. It is the Pipenv analogue of a pip resolution conflict - two constraints, or a Python requirement, cannot all be satisfied.

What this error means

pipenv lock or pipenv install aborts with Locking Failed! and "Your dependencies could not be resolved", sometimes naming the conflicting packages. It reproduces from the same Pipfile until a constraint is changed.

pipenv output
Locking Failed!
ERROR:pipenv.patched.pip._internal.resolution... ResolutionImpossible:
Your dependencies could not be resolved. You likely have a mismatch in
your sub-dependencies.

Common causes

Conflicting version constraints in the Pipfile

Two requirements pin incompatible versions of a shared package, so no lock satisfies both.

Python version mismatch

The [requires] python_version in the Pipfile, or the interpreter Pipenv selected, does not overlap a dependency’s supported Python.

Stale lock against an edited Pipfile

The Pipfile changed without re-locking, so CI with --deploy rejects the mismatch.

How to fix it

Re-lock and read the conflict

Lock verbosely to see which constraints collide, then relax the over-tight one.

Terminal
pipenv lock --verbose
# after fixing constraints
pipenv install --deploy   # fail if Pipfile.lock is out of date

Align the Python version

Pipfile
[requires]
python_version = "3.11"

How to prevent it

  • Commit Pipfile.lock and re-lock after editing the Pipfile.
  • Use pipenv install --deploy in CI to catch lock drift.
  • Keep python_version aligned with your dependencies’ support.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →