{"id":"9dee09ca8339d240","repo":"pypa/pip","slug":"python-3-8-or-later-is-required","errorCode":null,"errorMessage":"Python 3.8 or later is required","messagePattern":"Python 3\\.8 or later is required","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"src/pip/_vendor/pkg_resources/__init__.py","lineNumber":28,"sourceCode":"to have their path parts separated with ``/``, *not* whatever the local\npath separator is.  Do not use os.path operations to manipulate resource\nnames being passed into the API.\n\nThe package resource API is designed to work with normal filesystem packages,\n.egg files, and unpacked .egg files.  It can also work in a limited way with\n.zip files and with custom PEP 302 loaders that support the ``get_data()``\nmethod.\n\nThis module is deprecated. Users are directed to :mod:`importlib.resources`,\n:mod:`importlib.metadata` and :pypi:`packaging` instead.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport sys\n\nif sys.version_info < (3, 8):  # noqa: UP036 # Check for unsupported versions\n    raise RuntimeError(\"Python 3.8 or later is required\")\n\nimport os\nimport io\nimport time\nimport re\nimport types\nfrom typing import (\n    Any,\n    Literal,\n    Dict,\n    Iterator,\n    Mapping,\n    MutableSequence,\n    NamedTuple,\n    NoReturn,\n    Tuple,\n    Union,\n    TYPE_CHECKING,","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_vendor/pkg_resources/__init__.py#L10-L46","documentation":"pkg_resources is guarded at import time: if the running interpreter is older than Python 3.8, it raises RuntimeError immediately. pkg_resources is vendored inside pip and itself deprecated, but this hard floor exists so an unsupported interpreter fails fast rather than producing subtle SyntaxError or behavioral bugs. The check is at module top level, so merely importing pkg_resources (or any module that imports it) on Python 3.7 or earlier triggers it.","triggerScenarios":"Executing `import pkg_resources` (directly or transitively via pip, setuptools, or any dependency) on CPython/PyPy 3.7 or older. The guard is `if sys.version_info < (3, 8): raise RuntimeError(...)`.","commonSituations":"System Python still on 3.6/3.7 (older distros), a virtualenv built from an old interpreter, CI matrix pinning an EOL Python, or a Docker base image with a legacy Python. Since pkg_resources is widely imported transitively, the error surfaces even when the user never names the module.","solutions":["Upgrade the interpreter to Python 3.8+ (3.7 reached end-of-life June 2023); recreate any virtualenvs from a supported interpreter.","If stuck on an old Python, downgrade setuptools/pip to a version that still supported it, though this is not recommended long-term.","Migrate away from pkg_resources (it is deprecated) to importlib.resources / importlib.metadata, which have their own version floors but are the supported path forward."],"exampleFix":"// before\npython3.7 -c \"import pkg_resources\"  # RuntimeError: Python 3.8 or later is required\n\n// after\npython3.11 -c \"import pkg_resources\"  # OK","handlingStrategy":"validation","validationCode":"import sys\nif sys.version_info < (3, 8):\n    raise SystemExit('Python 3.8+ required; got %s' % '.'.join(map(str, sys.version_info[:3])))\n\n# safe to import only after the check\nimport pkg_resources","typeGuard":"# interpreter-level, not type-level; guard with a version check\nimport sys\nCAN_IMPORT_PKG_RESOURCES = sys.version_info >= (3, 8)","tryCatchPattern":"# ImportError/RuntimeError at import time cannot be usefully caught at the\n# same import site; guard before importing:\n# if sys.version_info >= (3, 8): import pkg_resources\n","preventionTips":["Pin your interpreter to Python 3.8+ in CI, Dockerfile, and tox/pyproject requires-python.","Recreate virtualenvs whenever you upgrade the base interpreter.","Set requires-python = '>=3.8' in your own project to fail fast for downstream users."],"tags":["version","python-version","import-time","compatibility","pkg-resources"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}