pypa/pip · error · PylockSelectError
python_full_version in provided environment does not…
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
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.
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.
Example fix
# before: lock has requires-python = ">=3.10" but you run/select on 3.9
pylock.select()
# after: select with an environment on a supported interpreter
pylock.select(environment={**packaging.markers.default_environment(), 'python_full_version': '3.11.4'}) Defensive patterns
Strategy: validation
Validate before calling
from packaging.specifiers import SpecifierSet
from packaging.markers import default_environment
def env_satisfies_lock_python(spec: SpecifierSet, environment=None) -> bool:
if not spec:
return True
py = (environment or default_environment())['python_full_version']
return spec.contains(py)
env = default_environment()
assert env_satisfies_lock_python(pylock.requires_python, env), pylock.requires_python Type guard
null
Try / catch
from packaging.pylock import PylockSelectError
try:
list(pylock.select(environment=env))
except PylockSelectError as e:
# message shows required vs actual python_full_version
report(e) Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Provided environment does not satisfy any of the…
- python_full_version in provided environment does not…
- Multiple packages with the name
- No wheel found matching the provided tags for package
- Python 3.8 or later is required
AI-assisted analysis of pypa/pip@f399c37189 (2026-08-08).
Data as JSON: /api/errors/5f48006131f66afd.
Report an issue: GitHub.
Appendix: source
Thrown at src/pip/_vendor/packaging/pylock.py:830
),
)
env_python_full_version = _pep440_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 f399c37189)