{"record":{"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":864,"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":846,"sourceCodeEnd":882,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_vendor/packaging/pylock.py#L846-L882","documentation":"PylockSelectError raised by Pylock.select when an individual package declares requires-python and the environment's python_full_version fails it. Unlike the lock-level requires-python (error 307), this is per-package and pinpoints the offending entry by packages[package_index].","triggerScenarios":"During the per-package loop in select(), if package.requires_python is set and not .contains(env_python_full_version), e.g. a package with requires-python='>=3.11' being selected on a 3.10 interpreter. The message names the package and its array index.","commonSituations":"A single dependency in the lock requires a newer Python than the rest; running on a stable interpreter where one transitive dep dropped support; a package whose requires-python was tightened in a patch update.","solutions":["Read the message to find the package name and packages[index], then check its requires-python.","Upgrade your interpreter to satisfy that package's requires-python, or remove/downgrade the package in the lock to a version supporting your Python.","Regenerate the lock against the actual target interpreter so resolver picks a compatible version.","If the package is optional, ensure its marker excludes the current environment so select() skips it instead of erroring."],"exampleFix":"# before: packages[4] name=\"rich\" requires-python=\">=3.11\", run on 3.10\npylock.select()\n\n# after: pin a version of that package supporting 3.10 and regenerate lock\n# pylock.toml: [[packages]] name=\"rich\" version=\"13.3\" requires-python=\">=3.7\"\npylock.select()","handlingStrategy":"validation","validationCode":"from packaging.specifiers import SpecifierSet\nfrom packaging.markers import default_environment\n\ndef packages_python_compatible(pylock, environment=None) -> list:\n    env = environment or default_environment()\n    py = env['python_full_version']\n    bad = []\n    for i, p in enumerate(pylock.packages):\n        if p.requires_python and not p.requires_python.contains(py):\n            bad.append((i, p.name, str(p.requires_python)))\n    return bad\n\nassert not packages_python_compatible(pylock, env)","typeGuard":"null","tryCatchPattern":"from packaging.pylock import PylockSelectError\ntry:\n    list(pylock.select(environment=env))\nexcept PylockSelectError as e:\n    # message names the package and index; pin a compatible version\n    report(e)","preventionTips":["Generate the lock on the lowest target interpreter so the resolver picks compatible versions.","Pre-screen packages for requires-python against your interpreter before select().","For optional deps, gate with a marker that excludes unsupported interpreters."],"tags":["pylock","packaging","python-version","select","package"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}