Skip to content
Latchkey

pipenv "Locking Failed!" dependency resolution in CI

pipenv ran its resolver over your Pipfile and could not find versions that satisfy every requirement. It prints "Locking Failed!" with the offending dependency and constraint.

What this error means

pipenv lock or pipenv install fails with "Locking Failed!" and a resolver trace naming the package whose constraints could not be satisfied.

python
Locking Failed!
ResolutionImpossible:
[('urllib3<2', ...), ('urllib3>=2', ...)]

Common causes

Incompatible constraints in the Pipfile

Two requirements demand non-overlapping ranges of a shared dependency, so pipenv cannot lock a single version.

A package unavailable for the target Python

A pinned package has no release for the Pipfile's python_version, so resolution fails.

How to fix it

Resolve the conflicting constraint

  1. Read which package pipenv could not lock.
  2. Loosen the over-tight constraint or upgrade the capping dependency in the Pipfile.
  3. Re-run pipenv lock and commit the new Pipfile.lock.
Terminal
pipenv lock --clear

Align python_version with available wheels

Set the Pipfile Python to a version your dependencies support so a lock is feasible.

Pipfile
[requires]
python_version = "3.12"

How to prevent it

  • Keep Pipfile constraints as ranges where possible.
  • Run pipenv lock before pushing so failures surface locally.
  • Match python_version to the wheels your dependencies publish.

Related guides

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