{"record":{"id":"5f48006131f66afd","repo":"pypa/pip","slug":"python-full-version-env-python-full-version-r-in","errorCode":null,"errorMessage":"python_full_version {env_python_full_version!r} in provided environment does not satisfy the Python version requirement {str(self.requires_python)!r}","messagePattern":"python_full_version (.+?) in provided environment does not satisfy the Python version requirement (.+?)","errorType":"exception","errorClass":"PylockSelectError","httpStatus":null,"severity":"error","filePath":"src/pip/_vendor/packaging/pylock.py","lineNumber":830,"sourceCode":"            ),\n        )\n        env_python_full_version = _pep440_python_full_version(\n            environment[\"python_full_version\"]\n            if environment\n            else default_environment()[\"python_full_version\"]\n        )\n\n        # #. Check if the metadata version specified by :ref:`pylock-lock-version` is\n        #    supported; an error or warning MUST be raised as appropriate.\n        # Covered by lock.validate() which is a precondition for this method.\n\n        # #. If :ref:`pylock-requires-python` is specified, check that the environment\n        #    being installed for meets the requirement; an error MUST be raised if it is\n        #    not met.\n        if self.requires_python and not self.requires_python.contains(\n            env_python_full_version,\n        ):\n            raise PylockSelectError(\n                f\"python_full_version {env_python_full_version!r} \"\n                f\"in provided environment does not satisfy the Python version \"\n                f\"requirement {str(self.requires_python)!r}\"\n            )\n\n        # #. If :ref:`pylock-environments` is specified, check that at least one of the\n        #    environment marker expressions is satisfied; an error MUST be raised if no\n        #    expression is satisfied.\n        if self.environments:\n            for env_marker in self.environments:\n                if env_marker.evaluate(\n                    cast(\"dict[str, str]\", environment or {}), context=\"requirement\"\n                ):\n                    break\n            else:\n                raise PylockSelectError(\n                    \"Provided environment does not satisfy any of the \"\n                    \"environments specified in the lock file\"","sourceCodeStart":812,"sourceCodeEnd":848,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_vendor/packaging/pylock.py#L812-L848","documentation":"PylockSelectError raised by Pylock.select when the lock-level requires-python specifier is not satisfied by the python_full_version of the (provided or default) environment. The lock declares which Python versions it covers; selecting for an incompatible interpreter is refused.","triggerScenarios":"Calling pylock.select(environment=...) (or with no environment, using default_environment()) when requires-python (e.g. '>=3.10') does not contain env_python_full_version (e.g. 3.9.x). The check is self.requires_python.contains(env_python_full_version).","commonSituations":"Running on an older Python than the lock targets; a CI matrix pinning the wrong interpreter; passing an environment dict whose python_full_version is mistyped or stale.","solutions":["Read the lock's top-level requires-python and the environment's python_full_version named in the message.","Switch to a Python interpreter whose full version satisfies requires-python (e.g. install/use 3.10+ when requires-python is '>=3.10').","If the target interpreter is correct, regenerate the lock with an appropriate requires-python covering your matrix.","Pass an explicit environment= dict with the correct python_full_version rather than relying on the running interpreter."],"exampleFix":"# before: lock has requires-python = \">=3.10\" but you run/select on 3.9\npylock.select()\n\n# after: select with an environment on a supported interpreter\npylock.select(environment={**packaging.markers.default_environment(), 'python_full_version': '3.11.4'})","handlingStrategy":"validation","validationCode":"from packaging.specifiers import SpecifierSet\nfrom packaging.markers import default_environment\n\ndef env_satisfies_lock_python(spec: SpecifierSet, environment=None) -> bool:\n    if not spec:\n        return True\n    py = (environment or default_environment())['python_full_version']\n    return spec.contains(py)\n\nenv = default_environment()\nassert env_satisfies_lock_python(pylock.requires_python, env), pylock.requires_python","typeGuard":"null","tryCatchPattern":"from packaging.pylock import PylockSelectError\ntry:\n    list(pylock.select(environment=env))\nexcept PylockSelectError as e:\n    # message shows required vs actual python_full_version\n    report(e)","preventionTips":["Read requires-python from the lock and align your interpreter before selecting.","Pass an explicit environment dict in CI rather than relying on the runner's interpreter.","Regenerate the lock on the lowest Python you intend to support."],"tags":["pylock","packaging","python-version","select","environment"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}