pypa/pip · error · SidecarMetadataInconsistent
Requested {ireq} has inconsistent Requires-Python between it
Error message
Requested {ireq} has inconsistent Requires-Python between its PEP 658 .metadata file and the wheel's METADATA: sidecar has {f_val!r}, wheel has {m_val!r} What it means
Raised as SidecarMetadataInconsistent for Requires-Python when the Python-version constraint in the PEP 658 .metadata sidecar differs from the wheel's METADATA. Checked at prepare.py:323-329; both values stringified. A mismatch could mislead the resolver into accepting or rejecting a wheel for the wrong Python versions.
Source
Thrown at src/pip/_internal/operations/prepare.py:324
str(wheel_dist.version),
)
# For multi-use fields, only report the symmetric difference to avoid
# unnecessarily flagging matching values.
sidecar_requires = _canonical_requires(
req, sidecar_dist, "the PEP 658 .metadata file"
)
wheel_requires = _canonical_requires(req, wheel_dist, "the wheel's METADATA")
if sidecar_requires != wheel_requires:
raise SidecarMetadataInconsistent(
req,
"Requires-Dist",
", ".join(sorted(sidecar_requires - wheel_requires)),
", ".join(sorted(wheel_requires - sidecar_requires)),
)
if sidecar_dist.requires_python != wheel_dist.requires_python:
raise SidecarMetadataInconsistent(
req,
"Requires-Python",
str(sidecar_dist.requires_python),
str(wheel_dist.requires_python),
)
sidecar_extras = frozenset(sidecar_dist.iter_provided_extras())
wheel_extras = frozenset(wheel_dist.iter_provided_extras())
if sidecar_extras != wheel_extras:
raise SidecarMetadataInconsistent(
req,
"Provides-Extra",
", ".join(sorted(sidecar_extras - wheel_extras)),
", ".join(sorted(wheel_extras - sidecar_extras)),
)
class RequirementPreparer:View on GitHub (pinned to d7d0d0a394)
Solutions
- Purge caches: pip cache purge, clear any mirror/CDN cache, then retry.
- Reinstall from the official index with the version pinned: pip install --index-url https://pypi.org/simple/ 'pkg==<ver>'.
- Verify your interpreter satisfies the wheel's actual Requires-Python by inspecting the wheel METADATA directly.
- Notify the index maintainer to regenerate .metadata on every wheel change.
Example fix
# before: sidecar Requires-Python >=3.8, wheel requires >=3.9 (on Python 3.8) pip install pkg # -> SidecarMetadataInconsistent Requires-Python # after: use a compatible Python or correct index python3.9 -m pip install --index-url https://pypi.org/simple/ 'pkg==1.0.0'
Defensive patterns
Strategy: validation
Validate before calling
# compare Requires-Python from sidecar vs wheel
if str(sidecar_requires_python) != str(wheel_requires_python):
logger.warning("Requires-Python mismatch; trusting wheel METADATA") Type guard
def requires_python_match(a, b) -> bool:
return str(a) == str(b) Prevention
- Confirm your interpreter satisfies the wheel's actual Requires-Python before install.
- Pin exact versions from a trusted index to avoid stale sidecars.
- Regenerate .metadata on Python-range changes for self-hosted indices.
When it happens
Trigger: The sidecar's Requires-Python specifier differs from the wheel's METADATA Requires-Python. E.g. sidecar says '>=3.8', wheel says '>=3.9'. Occurs for remote wheels fetched via PEP 658 metadata.
Common situations: Index/mirror serving a stale .metadata from when the package supported a broader Python range. CDN caching issues. Re-uploaded wheel with a tightened Requires-Python but unchanged .metadata.
Related errors
- Requested {ireq} has inconsistent Name between its PEP 658 .
- Requested {ireq} has inconsistent Version between its PEP 65
- Requested {ireq} has inconsistent Provides-Extra between its
- Requested {ireq} has inconsistent Requires-Dist between its
- Requested {ireq} has inconsistent Name: expected {f_val!r},
AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04).
Data as JSON: /data/errors/218fc8919057b4dd.json.
Report an issue: GitHub.