{"record":{"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":"validation","errorClass":"PylockUnsupportedVersionError","httpStatus":null,"severity":"error","filePath":"src/pip/_vendor/packaging/pylock.py","lineNumber":721,"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":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_vendor/packaging/pylock.py#L703-L739","documentation":"PylockUnsupportedVersionError (a PylockValidationError subclass) raised by Pylock._from_dict when the lock's lock-version is not in the supported range [1.0, 2.0). The library only implements PEP 751 lock version 1.x; a 0.x or 2.0+ file is rejected outright.","triggerScenarios":"Calling Pylock.from_dict on a TOML dict whose lock-version = '0.1' (draft/older schema), '2.0' (a newer major revision this vendored packaging does not yet support), or a non-PEP440 string. The check is 'Version(\"1\") <= lock_version < Version(\"2\")'. A lock-version above '1.0' but below '2.0' also emits a warning that the minor version is unsupported.","commonSituations":"Reading a lock produced by a newer tool that writes lock-version 2.x; a hand-authored file using lock-version 1; upgrading packaging and encountering a lock from the future.","solutions":["Open pylock.toml and read the top-level lock-version field.","If it is 0.x or 2.0+, set it to a supported value like '1.0' only if the rest of the schema is actually 1.x-compatible; otherwise regenerate the lock.","Upgrade pip/packaging to a version that supports the lock-version you have, if available.","Re-run Pylock.from_dict; if lock-version > 1.0 but < 2.0 you may also see a warning that the minor version is unsupported — verify behavior."],"exampleFix":"# before\nlock-version = \"2.0\"\n\n# after\nlock-version = \"1.0\"","handlingStrategy":"validation","validationCode":"from packaging.version import Version\n\ndef supported_lock_version(v) -> bool:\n    try:\n        lv = Version(str(v))\n    except Exception:\n        return False\n    return Version('1') <= lv < Version('2')\n\nassert supported_lock_version(toml_dict['lock-version']), toml_dict['lock-version']","typeGuard":"null","tryCatchPattern":"from packaging.pylock import Pylock, PylockUnsupportedVersionError\ntry:\n    Pylock.from_dict(toml_dict)\nexcept PylockUnsupportedVersionError as e:\n    # read lock-version; upgrade packaging or pin the lock to a 1.x version\n    report(e.message)","preventionTips":["Pin the lock-producing tool and packaging to compatible versions across your team/CI.","Treat a major lock-version bump as a breaking change; regenerate locks deliberately.","Gate loads on supported_lock_version() before calling from_dict."],"tags":["pylock","packaging","version","schema","compatibility"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}