{"id":"4cb94186c5122d79","repo":"pypa/pip","slug":"pylock-version-pylock-lock-version-is-not-suppor","errorCode":null,"errorMessage":"pylock version {pylock.lock_version} is not supported","messagePattern":"pylock version (.+?) is not supported","errorType":"exception","errorClass":"PylockUnsupportedVersionError","httpStatus":null,"severity":"error","filePath":"src/pip/_vendor/packaging/pylock.py","lineNumber":705,"sourceCode":"        object.__setattr__(self, \"created_by\", created_by)\n        object.__setattr__(self, \"packages\", packages)\n        object.__setattr__(self, \"tool\", tool)\n\n    @classmethod\n    def _from_dict(cls, d: Mapping[str, Any]) -> Self:\n        pylock = cls(\n            lock_version=_get_required_as(d, str, Version, \"lock-version\"),\n            environments=_get_sequence_as(d, str, Marker, \"environments\"),\n            extras=_get_sequence_as(d, str, _validate_normalized_name, \"extras\"),\n            dependency_groups=_get_sequence(d, str, \"dependency-groups\"),\n            default_groups=_get_sequence(d, str, \"default-groups\"),\n            created_by=_get_required(d, str, \"created-by\"),\n            requires_python=_get_as(d, str, SpecifierSet, \"requires-python\"),\n            packages=_get_required_sequence_of_objects(d, Package, \"packages\"),\n            tool=_get(d, Mapping, \"tool\"),  # type: ignore[type-abstract]\n        )\n        if not Version(\"1\") <= pylock.lock_version < Version(\"2\"):\n            raise PylockUnsupportedVersionError(\n                f\"pylock version {pylock.lock_version} is not supported\"\n            )\n        if pylock.lock_version > Version(\"1.0\"):\n            _logger.warning(\n                \"pylock minor version %s is not supported\", pylock.lock_version\n            )\n        return pylock\n\n    @classmethod\n    def from_dict(cls, d: Mapping[str, Any], /) -> Self:\n        \"\"\"Create and validate a Pylock instance from a TOML dictionary.\n\n        Raises :class:`PylockValidationError` if the input data is not\n        spec-compliant.\n        \"\"\"\n        return cls._from_dict(d)\n\n    def to_dict(self) -> Mapping[str, Any]:","sourceCodeStart":687,"sourceCodeEnd":723,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_vendor/packaging/pylock.py#L687-L723","documentation":"Raised as PylockUnsupportedVersionError (pylock.py:705), a subclass of PylockValidationError, when the parsed lock_version falls outside the supported range [1, 2). The check is `not (Version('1') <= lock_version < Version('2'))`, so 0.x, 2.x, or any non-1.x major version is rejected outright.","triggerScenarios":"Pylock.from_dict() on a TOML whose lock-version is '2.0', '0.1', or '3'. Note: minor bumps above 1.0 (e.g. 1.1) only emit a logger.warning at pylock.py:709, they do NOT raise; only majors outside 1.x raise.","commonSituations":"A newer lock format (pylock v2) is published but this packaging version only supports v1. Conversely, an experimental/old draft lock with version 0.x. vendored packaging lagging behind the resolver that wrote the lock.","solutions":["Upgrade pip/packaging to a release that supports the lock_version you are reading.","Downgrade/regenerate the lock file to lock-version = '1.x'.","Confirm the lock-version field is present and correctly formatted; a missing/malformed value surfaces as a different error first."],"exampleFix":"# before\nlock-version = \"2.0\"\n\n# after\nlock-version = \"1.0\"","handlingStrategy":"try-catch","validationCode":"from pip._vendor.packaging.version import Version\ndef is_supported_lock_version(v):\n    return Version('1') <= Version(str(v)) < Version('2')","typeGuard":"null","tryCatchPattern":"from pip._vendor.packaging.pylock import PylockUnsupportedVersionError\ntry:\n    Pylock.from_dict(d)\nexcept PylockUnsupportedVersionError as e:\n    upgrade_packaging_or_regenerate_lock(e)","preventionTips":["Check the lock-version field before loading and upgrade packaging if it is >=2.","Pin packaging versions in CI to match the resolver that wrote the lock."],"tags":["pylock","version","packaging","compatibility"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}