pypa/pip · error · PylockSelectError
python_full_version {env_python_full_version!r} in provided
Error message
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}] What it means
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].
Source
Thrown at src/pip/_vendor/packaging/pylock.py:835
raise PylockSelectError(
"Provided environment does not satisfy any of the "
"environments specified in the lock file"
)
# #. For each package listed in :ref:`pylock-packages`:
selected_packages_by_name: dict[str, tuple[int, Package]] = {}
for package_index, package in enumerate(self.packages):
# #. If :ref:`pylock-packages-marker` is specified, check if it is
# satisfied;if it isn't, skip to the next package.
if package.marker and not package.marker.evaluate(env, context="lock_file"):
continue
# #. If :ref:`pylock-packages-requires-python` is specified, check if it is
# satisfied; an error MUST be raised if it isn't.
if package.requires_python and not package.requires_python.contains(
env_python_full_version,
):
raise PylockSelectError(
f"python_full_version {env_python_full_version!r} "
f"in provided environment does not satisfy the Python version "
f"requirement {str(package.requires_python)!r} for package "
f"{package.name!r} at packages[{package_index}]"
)
# #. Check that no other conflicting instance of the package has been slated
# to be installed; an error about the ambiguity MUST be raised otherwise.
if package.name in selected_packages_by_name:
raise PylockSelectError(
f"Multiple packages with the name {package.name!r} are "
f"selected at packages[{package_index}] and "
f"packages[{selected_packages_by_name[package.name][0]}]"
)
# #. Check that the source of the package is specified appropriately (i.e.
# there are no conflicting sources in the package entry);
# an error MUST be raised if any issues are found.View on GitHub (pinned to d7d0d0a394)
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.
Example fix
# before: package at packages[7] has requires-python = ">=3.12"; host is 3.11
pylock.select()
# after
pylock.select(environment={'python_full_version': '3.12.0',
'python_version': '3.12',
'os_name': 'posix'}) Defensive patterns
Strategy: validation
Validate before calling
from pip._vendor.packaging.specifiers import SpecifierSet
def env_satisfies_package_python(package_requires_python, python_full_version):
return (not package_requires_python) or SpecifierSet(package_requires_python).contains(python_full_version) Type guard
null
Try / catch
from pip._vendor.packaging.pylock import PylockSelectError
try:
list(pylock.select(environment=env))
except PylockSelectError as e:
if 'for package' in str(e):
isolate_offending_package(e) Prevention
- Pair each package's requires-python with a marker that excludes unsupported interpreters.
- Audit transitive dependencies' python-requires during lock generation.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- python_full_version {env_python_full_version!r} in provided
- Version in {wheel.filename!r} is not consistent with package
- Invalid sdist filename {package.sdist.filename!r}
- Name in {package.sdist.filename!r} is not consistent with pa
- Version in {package.sdist.filename!r} is not consistent with
AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04).
Data as JSON: /data/errors/300e825c7a74cbf0.json.
Report an issue: GitHub.