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.
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
- Read which package pipenv could not lock.
- Loosen the over-tight constraint or upgrade the capping dependency in the Pipfile.
- Re-run
pipenv lockand commit the newPipfile.lock.
pipenv lock --clearAlign python_version with available wheels
Set the Pipfile Python to a version your dependencies support so a lock is feasible.
[requires]
python_version = "3.12"How to prevent it
- Keep Pipfile constraints as ranges where possible.
- Run
pipenv lockbefore pushing so failures surface locally. - Match
python_versionto the wheels your dependencies publish.