{"record":{"id":"b4c34be9385942dc","repo":"pypa/pip","slug":"deprecation-reason-pip-gone-in-will-enforce-t","errorCode":null,"errorMessage":"DEPRECATION: {reason} pip {gone_in} will enforce this behaviour change.","messagePattern":"DEPRECATION: (.+?) pip (.+?) will enforce this behaviour change\\.","errorType":"exception","errorClass":"PipDeprecationWarning","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/utils/deprecation.py","lineNumber":140,"sourceCode":"                if not is_gone\n                else None\n            ),\n        ),\n        (\n            issue,\n            \"Discussion can be found at https://github.com/pypa/pip/issues/{}\",\n        ),\n    ]\n\n    message = \" \".join(\n        format_str.format(value)\n        for value, format_str in message_parts\n        if format_str is not None and value is not None\n    )\n\n    # Raise as an error if this behaviour is deprecated.\n    if is_gone:\n        raise PipDeprecationWarning(message)\n\n    warning = PipDeprecationWarning(message)\n    warning.include_source = include_source\n    warnings.warn(warning, stacklevel=stacklevel)\n","sourceCodeStart":122,"sourceCodeEnd":145,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/utils/deprecation.py#L122-L145","documentation":"Raised as PipDeprecationWarning (promoted to an error when is_gone is True, i.e. pip's current version >= gone_in version) when deprecated functionality has reached its scheduled removal version. Before the removal version it is emitted as a warning via warnings.warn; at or past gone_in, the deprecated() function raises it as an exception, halting the operation. The message includes the reason, the enforcing version, and optionally a replacement suggestion and feature flag.","triggerScenarios":"Calling deprecated() with a gone_in parameter whose version is <= the running pip version. In test environments, _PIP_TEST_ENV is set which promotes all PipDeprecationWarning to errors via warnings.simplefilter('error', PipDeprecationWarning) at deprecation.py:54, so even pre-removal deprecations will raise.","commonSituations":"Upgrading pip to a newer version that has removed a feature you relied on. Using deprecated flags like --use-deprecated=legacy-resolver after its removal version. Running pip's own test suite (which sets _PIP_TEST_ENV and turns all deprecation warnings into errors).","solutions":["Read the deprecation message for the suggested replacement and migrate to it.","Remove the deprecated flag or option from your pip invocation or requirements.","Pin to an older pip version (`python -m pip install pip==<gone_in_prev>`) only as a temporary stopgap while migrating.","If running pip's tests, ensure you are not triggering genuinely deprecated internal APIs in your test code."],"exampleFix":"// before\n$ pip install --use-deprecated=legacy-resolver pkg\n\n// after\n$ pip install pkg  # resolver deprecation removed, use default","handlingStrategy":"validation","validationCode":"import subprocess, sys\n\ndef pip_supports_feature(flag: str) -> bool:\n    \"\"\"Check if the current pip version still supports a flag.\"\"\"\n    result = subprocess.run(\n        [sys.executable, '-m', 'pip', '--help'],\n        capture_output=True, text=True\n    )\n    return flag in result.stdout\n\n# Before using a deprecated flag, verify it still exists","typeGuard":"def is_deprecated_flag_removed(flag: str, pip_help_output: str) -> bool:\n    \"\"\"True if the flag is absent from pip --help (likely removed).\"\"\"\n    return flag not in pip_help_output","tryCatchPattern":null,"preventionTips":["Pin your pip version in CI to avoid surprise deprecation removals.","Subscribe to pip release notes and migrate deprecated flags before upgrading.","Run a dry-run install after upgrading pip to surface deprecation errors early."],"tags":["deprecation","versioning","migration","pip-internal"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}