{"record":{"id":"44aa01424d2cf8aa","repo":"aio-libs/aiohttp","slug":"aiohttp-4-x-requires-python-3-10","errorCode":null,"errorMessage":"aiohttp 4.x requires Python 3.10+","messagePattern":"aiohttp 4\\.x requires Python 3\\.10\\+","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"setup.py","lineNumber":9,"sourceCode":"import os\nimport pathlib\nimport sys\n\nfrom setuptools import Extension, setup\nfrom setuptools.command.build_ext import build_ext\n\nif sys.version_info < (3, 10):\n    raise RuntimeError(\"aiohttp 4.x requires Python 3.10+\")\n\n\nUSE_SYSTEM_DEPS = bool(\n    os.environ.get(\"AIOHTTP_USE_SYSTEM_DEPS\", os.environ.get(\"USE_SYSTEM_DEPS\"))\n)\nNO_EXTENSIONS: bool = bool(os.environ.get(\"AIOHTTP_NO_EXTENSIONS\"))\nCYTHON_TRACING: bool = bool(os.environ.get(\"AIOHTTP_CYTHON_TRACE\"))\nHERE = pathlib.Path(__file__).parent\nIS_GIT_REPO = (HERE / \".git\").exists()\n\n\nif sys.implementation.name != \"cpython\":\n    NO_EXTENSIONS = True\n\n\nif (\n    not USE_SYSTEM_DEPS\n    and IS_GIT_REPO","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/aio-libs/aiohttp/blob/d041d4d0fd48c3f0832084d33be16cf1c4835f85/setup.py#L1-L27","documentation":"Raised by setup.py at the top level when sys.version_info is below (3, 10). aiohttp 4.x dropped support for Python 3.9 and earlier, so setup.py hard-aborts install/build (pip install, pip install -e, setup.py develop) on an unsupported interpreter before any compilation happens. This surfaces the requirement early instead of failing later in Cython compilation.","triggerScenarios":"Running `pip install aiohttp`, `pip install -e .`, or `python setup.py ...` with an active Python 3.9 or older interpreter against the aiohttp 4.x source tree.","commonSituations":"Upgrading a project pinned to Python 3.9 from aiohttp 3.x to 4.x; CI matrix that still includes 3.9; a Docker base image tagged python:3.9.","solutions":["Upgrade the runtime to Python 3.10+ (3.11/3.12 recommended) and reinstall.","If you cannot upgrade Python, stay on the aiohttp 3.x release line (`pip install 'aiohttp<4'`).","Update pyproject.toml / tox / CI `python-version` matrices to drop 3.9 when adopting aiohttp 4."],"exampleFix":"// before\n$ python --version\nPython 3.9.18\n$ pip install -e .\nRuntimeError: aiohttp 4.x requires Python 3.10+\n\n// after\n$ python3.12 -m venv .venv && source .venv/bin/activate\n$ pip install -e .   # ok\n# or, stuck on 3.9:\n$ pip install 'aiohttp<4'","handlingStrategy":"validation","validationCode":"import sys\nassert sys.version_info >= (3, 10), 'aiohttp 4.x requires Python 3.10+'","typeGuard":"def python_supports_aiohttp4() -> bool:\n    import sys\n    return sys.version_info >= (3, 10)","tryCatchPattern":"# raised at install time; pin a compatible interpreter or aiohttp line.\n# In CI matrix selection:\ntry:\n    subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-e', '.'])\nexcept SystemExit:\n    subprocess.check_call([sys.executable, '-m', 'pip', 'install', \"'aiohttp<4'\"])","preventionTips":["Upgrade runtimes to Python 3.10+ before adopting aiohttp 4.x.","Pin `aiohttp<4` in requirements if you must stay on 3.9.","Update CI/tox matrices to drop 3.9 alongside the aiohttp 4 upgrade."],"tags":["install","python-version","build","upgrade"],"backgroundTag":null,"analyzedSha":"d041d4d0fd48c3f0832084d33be16cf1c4835f85","analyzedAt":"2026-08-11T20:44:15.550Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}