{"id":"a14416b8ea57522b","repo":"pypa/pip","slug":"provided-environment-does-not-satisfy-any-of-the-e","errorCode":null,"errorMessage":"Provided environment does not satisfy any of the environments specified in the lock file","messagePattern":"Provided environment does not satisfy any of the environments specified in the lock file","errorType":"exception","errorClass":"PylockSelectError","httpStatus":null,"severity":"error","filePath":"src/pip/_vendor/packaging/pylock.py","lineNumber":817,"sourceCode":"            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(self.requires_python)!r}\"\n            )\n\n        # #. If :ref:`pylock-environments` is specified, check that at least one of the\n        #    environment marker expressions is satisfied; an error MUST be raised if no\n        #    expression is satisfied.\n        if self.environments:\n            for env_marker in self.environments:\n                if env_marker.evaluate(\n                    cast(\"dict[str, str]\", environment or {}), context=\"requirement\"\n                ):\n                    break\n            else:\n                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(","sourceCodeStart":799,"sourceCodeEnd":835,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_vendor/packaging/pylock.py#L799-L835","documentation":"Raised as PylockSelectError (pylock.py:817) by Pylock.select() when the lock declares an 'environments' list (a list of PEP 508 marker expressions) and none of them evaluate True against the provided environment. It enforces the spec requirement that at least one environment marker must match before selection proceeds.","triggerScenarios":"Calling pylock.select(environment=env) where env is, say, linux-only but every entry in environments[] is a marker like 'platform_system == \"Windows\"'. Also fires when environment is omitted and the running interpreter matches none of the listed markers.","commonSituations":"Cross-platform lock consumed on an unsupported platform/implementation. A marker typo (e.g. 'platform_system == \"Linuz\"') that never matches anything. Omitting the environment argument on a host that the lock was not authored for.","solutions":["Pass an environment dict that satisfies at least one entry in the lock's environments list.","Run on a platform/interpreter the lock explicitly targets.","Fix or extend the environments list in the lock to include the target platform's marker."],"exampleFix":"# before: lock has environments = ['platform_system == \"Windows\"']; running on Linux\npylock.select()\n\n# after: pass a matching environment, or fix the lock\npylock.select(environment={'platform_system': 'Windows',\n                            'python_full_version': '3.11.6',\n                            'python_version': '3.11'})","handlingStrategy":"validation","validationCode":"from pip._vendor.packaging.markers import Marker\ndef env_matches_any_lock_environment(environments, env_dict):\n    return any(Marker(m).evaluate(env_dict) for m in (environments or []))","typeGuard":"null","tryCatchPattern":"from pip._vendor.packaging.pylock import PylockSelectError\ntry:\n    list(pylock.select(environment=env))\nexcept PylockSelectError as e:\n    if 'does not satisfy any of the environments' in str(e):\n        provide_compatible_environment(e)","preventionTips":["Author environments markers that cover every target platform you intend to support.","Validate environment markers against your CI matrix before publishing the lock."],"tags":["pylock","select","markers","environment"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}