{"record":{"id":"9e0d83d99abdccdf","repo":"pypa/pip","slug":"this-version-of-pip-does-not-support-python-re","errorCode":null,"errorMessage":"This version of pip does not support python {} (requires >={}).","messagePattern":"This version of pip does not support python (.+?) \\(requires >=(.+?)\\)\\.","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"critical","filePath":"src/pip/__pip-runner__.py","lineNumber":20,"sourceCode":"\nThis file is named as it is, to ensure that this module can't be imported via\nan import statement.\n\"\"\"\n\n# /!\\ This version compatibility check section must be Python 2 compatible. /!\\\n\nimport sys\n\n# Copied from pyproject.toml\nPYTHON_REQUIRES = (3, 10)\n\n\ndef version_str(version):  # type: ignore\n    return \".\".join(str(v) for v in version)\n\n\nif sys.version_info[:2] < PYTHON_REQUIRES:\n    raise SystemExit(\n        \"This version of pip does not support python {} (requires >={}).\".format(\n            version_str(sys.version_info[:2]), version_str(PYTHON_REQUIRES)\n        )\n    )\n\n# From here on, we can use Python 3 features, but the syntax must remain\n# Python 2 compatible.\n\nimport runpy  # noqa: E402\nfrom importlib.machinery import PathFinder  # noqa: E402\nfrom os.path import dirname  # noqa: E402\n\nPIP_SOURCES_ROOT = dirname(dirname(__file__))\n\n\nclass PipImportRedirectingFinder:\n    @classmethod\n    def find_spec(self, fullname, path=None, target=None):  # type: ignore","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/__pip-runner__.py#L2-L38","documentation":"Raised as a SystemExit from pip's internal runner module (__pip-runner__.py) when pip is re-invoked under a target interpreter (via `pip --python <exe>`) whose version is below the minimum pip supports (currently 3.10, copied from pyproject.toml's PYTHON_REQUIRES at line 12). The check at line 19 compares sys.version_info[:2] against PYTHON_REQUIRES before any pip logic runs. It exists so that running modern pip under an ancient Python fails fast with a clear message instead of cryptic syntax/import errors.","triggerScenarios":"Invoking `pip install --python /usr/bin/python3.9 <pkg>` (or any subcommand with --python) where the named interpreter reports a version older than 3.10. The __pip-runner__.py module is executed by that target interpreter, which then triggers the guard at line 19-24.","commonSituations":"Building for or targeting a legacy Python (3.8/3.9) after upgrading pip to a version that dropped support for it; CI matrices that still install old Python but use a shared new pip; system-managed pip on a host where python3 points to an old interpreter.","solutions":["Point --python at an interpreter that is Python 3.10 or newer (e.g. `pip --python python3.11 install <pkg>`).","If you must target an older Python, downgrade pip to a version that still supports it (the last pip supporting 3.8 is pip 24.0; 3.9 support ended with pip 24.1).","Remove the --python flag entirely so pip runs under its own current interpreter and uses cross-platform flags (--platform/--python-version) for targeting instead."],"exampleFix":"# before\npip install --python /usr/bin/python3.9 requests\n# after\npip install --python /usr/bin/python3.11 requests","handlingStrategy":"validation","validationCode":"# Before re-invoking pip under a target interpreter, verify it meets pip's minimum.\nimport subprocess, sys\nMIN = (3, 10)\npath = \"/usr/bin/python3.9\"\nout = subprocess.check_output([path, \"-c\", \"import sys; print(sys.version_info[:2])\"], text=True)\nv = eval(out)\nif v < MIN:\n    print(f\"pip requires Python >={MIN[0]}.{MIN[1]}, found {v[0]}.{v[1]}\"); sys.exit(1)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin your CI Python versions to >= the minimum pip supports (currently 3.10).","When using pip --python, validate the target interpreter version before invoking pip."],"tags":["python-version","compatibility","pip-runner","system-exit"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}