{"id":"300e825c7a74cbf0","repo":"pypa/pip","slug":"python-full-version-env-python-full-version-r-in-300e82","errorCode":null,"errorMessage":"python_full_version {env_python_full_version!r} in provided environment does not satisfy the Python version requirement {str(package.requires_python)!r} for package {package.name!r} at packages[{package_index}]","messagePattern":"python_full_version (.+?) in provided environment does not satisfy the Python version requirement (.+?) for package (.+?) at packages\\[(.+?)\\]","errorType":"exception","errorClass":"PylockSelectError","httpStatus":null,"severity":"error","filePath":"src/pip/_vendor/packaging/pylock.py","lineNumber":835,"sourceCode":"                raise PylockSelectError(\n                    \"Provided environment does not satisfy any of the \"\n                    \"environments specified in the lock file\"\n                )\n\n        # #. For each package listed in :ref:`pylock-packages`:\n        selected_packages_by_name: dict[str, tuple[int, Package]] = {}\n        for package_index, package in enumerate(self.packages):\n            # #. If :ref:`pylock-packages-marker` is specified, check if it is\n            #    satisfied;if it isn't, skip to the next package.\n            if package.marker and not package.marker.evaluate(env, context=\"lock_file\"):\n                continue\n\n            # #. If :ref:`pylock-packages-requires-python` is specified, check if it is\n            #    satisfied; an error MUST be raised if it isn't.\n            if package.requires_python and not package.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(package.requires_python)!r} for package \"\n                    f\"{package.name!r} at packages[{package_index}]\"\n                )\n\n            # #. Check that no other conflicting instance of the package has been slated\n            #    to be installed; an error about the ambiguity MUST be raised otherwise.\n            if package.name in selected_packages_by_name:\n                raise PylockSelectError(\n                    f\"Multiple packages with the name {package.name!r} are \"\n                    f\"selected at packages[{package_index}] and \"\n                    f\"packages[{selected_packages_by_name[package.name][0]}]\"\n                )\n\n            # #. Check that the source of the package is specified appropriately (i.e.\n            #    there are no conflicting sources in the package entry);\n            #    an error MUST be raised if any issues are found.","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_vendor/packaging/pylock.py#L817-L853","documentation":"Raised as PylockSelectError (pylock.py:835) by Pylock.select() during package iteration when an individual package's requires-python specifier is not satisfied by the environment's python_full_version. Unlike the lock-level check (325), this fires per-package, after the package's own marker already passed, and reports the offending packages[index].","triggerScenarios":"select() reaches a package whose marker matches the env but whose requires-python does not, e.g. package requires-python = '>=3.12' selected under python_full_version '3.11.x'. The index in the message is the package's position in self.packages.","commonSituations":"A lock mixes packages with heterogeneous Python requirements and is consumed on a Python that satisfies the lock-level gate but not a specific transitive dependency's gate. Inconsistent requires-python authored into the lock.","solutions":["Select for a Python version that satisfies the named package's requires-python.","Adjust the package's marker so it is skipped on incompatible Pythons instead of failing selection.","Loosen the package's requires-python in the lock if the constraint is wrong."],"exampleFix":"# before: package at packages[7] has requires-python = \">=3.12\"; host is 3.11\npylock.select()\n\n# after\npylock.select(environment={'python_full_version': '3.12.0',\n                            'python_version': '3.12',\n                            'os_name': 'posix'})","handlingStrategy":"validation","validationCode":"from pip._vendor.packaging.specifiers import SpecifierSet\ndef env_satisfies_package_python(package_requires_python, python_full_version):\n    return (not package_requires_python) or SpecifierSet(package_requires_python).contains(python_full_version)","typeGuard":"null","tryCatchPattern":"from pip._vendor.packaging.pylock import PylockSelectError\ntry:\n    list(pylock.select(environment=env))\nexcept PylockSelectError as e:\n    if 'for package' in str(e):\n        isolate_offending_package(e)","preventionTips":["Pair each package's requires-python with a marker that excludes unsupported interpreters.","Audit transitive dependencies' python-requires during lock generation."],"tags":["pylock","select","python-version","packaging"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}