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(package.requires_python)!r} for package {package.name!r} at packages[{package_index}] What it means
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].
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.
Example fix
# before: packages[4] name="rich" requires-python=">=3.11", run on 3.10 pylock.select() # after: pin a version of that package supporting 3.10 and regenerate lock # pylock.toml: [[packages]] name="rich" version="13.3" requires-python=">=3.7" pylock.select()
Defensive patterns
Strategy: validation
Validate before calling
from packaging.specifiers import SpecifierSet
from packaging.markers import default_environment
def packages_python_compatible(pylock, environment=None) -> list:
env = environment or default_environment()
py = env['python_full_version']
bad = []
for i, p in enumerate(pylock.packages):
if p.requires_python and not p.requires_python.contains(py):
bad.append((i, p.name, str(p.requires_python)))
return bad
assert not packages_python_compatible(pylock, env) Type guard
null
Try / catch
from packaging.pylock import PylockSelectError
try:
list(pylock.select(environment=env))
except PylockSelectError as e:
# message names the package and index; pin a compatible version
report(e) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- python_full_version in provided environment does not…
- Multiple packages with the name
- No wheel found matching the provided tags for package
- Provided environment does not satisfy any of the…
- Invalid sdist filename
AI-assisted analysis of pypa/pip@f399c37189 (2026-08-08).
Data as JSON: /api/errors/300e825c7a74cbf0.
Report an issue: GitHub.
Appendix: source
Thrown at src/pip/_vendor/packaging/pylock.py:864
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 f399c37189)