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(self.requires_python)!r} What it means
Raised as PylockSelectError (pylock.py:801) by Pylock.select() when the lock-level requires-python specifier set is not satisfied by python_full_version of the selection environment. It is the first guard inside select(): if the whole lock requires Python >=3.10 and you select for 3.9, it fails before any package logic runs.
Source
Thrown at src/pip/_vendor/packaging/pylock.py:801
),
)
env_python_full_version = (
environment["python_full_version"]
if environment
else default_environment()["python_full_version"]
)
# #. Check if the metadata version specified by :ref:`pylock-lock-version` is
# supported; an error or warning MUST be raised as appropriate.
# Covered by lock.validate() which is a precondition for this method.
# #. If :ref:`pylock-requires-python` is specified, check that the environment
# being installed for meets the requirement; an error MUST be raised if it is
# not met.
if self.requires_python and not self.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(self.requires_python)!r}"
)
# #. If :ref:`pylock-environments` is specified, check that at least one of the
# environment marker expressions is satisfied; an error MUST be raised if no
# expression is satisfied.
if self.environments:
for env_marker in self.environments:
if env_marker.evaluate(
cast("dict[str, str]", environment or {}), context="requirement"
):
break
else:
raise PylockSelectError(
"Provided environment does not satisfy any of the "
"environments specified in the lock file"View on GitHub (pinned to d7d0d0a394)
Solutions
- Switch to a Python interpreter whose full version satisfies the lock's requires-python.
- Pass an explicit environment dict whose python_full_version satisfies requires-python, if you are selecting for a different target than the host.
- Loosen requires-python in the lock (only if you control it and it is actually compatible).
Example fix
# before: lock says requires-python = ">=3.11"; host is 3.10
pylock.select()
# after
pylock.select(environment={'python_full_version': '3.11.6',
'python_version': '3.11',
'os_name': 'posix',
'sys_platform': 'linux'}) Defensive patterns
Strategy: validation
Validate before calling
from pip._vendor.packaging.specifiers import SpecifierSet
def env_satisfies_lock_python(requires_python, python_full_version):
return (not requires_python) or SpecifierSet(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 'requires-python' in str(e) or 'Python version requirement' in str(e):
switch_interpreter_or_env(e) Prevention
- Pass an explicit environment dict that matches your target interpreter.
- Keep the lock's requires-python aligned with the interpreters you actually run.
When it happens
Trigger: Calling pylock.select(environment={'python_full_version': '3.9.1', ...}) on a lock whose [root] requires-python = '>=3.10'. Also triggered when environment is omitted and default_environment()['python_full_version'] (the running interpreter) violates requires-python.
Common situations: CI runs the lock on a different Python than the author used. A user omits the environment argument and the host Python is older than the lock allows. Cross-platform lock installed under the wrong interpreter.
Related errors
- Provided environment does not satisfy any of the environment
- python_full_version {env_python_full_version!r} in provided
- Multiple packages with the name {package.name!r} are selecte
- No wheel found matching the provided tags for package {packa
- This version of pip does not support python {} (requires >={
AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04).
Data as JSON: /data/errors/5f48006131f66afd.json.
Report an issue: GitHub.