Jump to solution
Verify

The Fix

Prevent errors when using aiohttp from a Python 3.14 build that does not include compression.zstd support.

Based on closed aio-libs/aiohttp issue #11603 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Jump to Verify Open PR/Commit
@@ -0,0 +1 @@ @@ -0,0 +1 @@ +Fixed Python 3.14 support when built without ``zstd`` support -- by :user:`JacobHenner`. diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index f123d1543fe..b64d99fb632 100644
repro.py
import aiohttp .tox/test/lib/python3.14/site-packages/aiohttp/__init__.py:6: in <module> from .client import ( .tox/test/lib/python3.14/site-packages/aiohttp/client.py:40: in <module> from . import hdrs, http, payload .tox/test/lib/python3.14/site-packages/aiohttp/http.py:7: in <module> from .http_parser import ( .tox/test/lib/python3.14/site-packages/aiohttp/http_parser.py:29: in <module> from .compression_utils import ( .tox/test/lib/python3.14/site-packages/aiohttp/compression_utils.py:25: in <module> import compression.zstd # noqa: I900 ^^^^^^^^^^^^^^^^^^^^^^^ /opt/python/3.14/lib/python3.14/compression/zstd/__init__.py:29: in <module> import _zstd E ModuleNotFoundError: No module named '_zstd'
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Apply the official fix\nPrevent errors when using aiohttp from a Python 3.14 build that does not include compression.zstd support.\nWhen NOT to use: This fix should not be used if zstd support is required for functionality.\n\n

Why This Fix Works in Production

  • Trigger: import aiohttp
  • Mechanism: Prevent errors when using aiohttp from a Python 3.14 build that does not include compression.zstd support.
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Shows up under Python 3.14 in real deployments (not just unit tests).
  • Surfaces as: import aiohttp

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Related to https://github.com/python/cpython/issues/139707”
@ShaneHarvey · 2025-10-07 · source
“Yeah, we can probably work around that, similar to the <3.14 approach.”
@Dreamsorcerer · 2025-10-07 · source

Failure Signature (Search String)

  • import aiohttp

Error Message

Stack trace
error.txt
Error Message ------------- import aiohttp .tox/test/lib/python3.14/site-packages/aiohttp/__init__.py:6: in <module> from .client import ( .tox/test/lib/python3.14/site-packages/aiohttp/client.py:40: in <module> from . import hdrs, http, payload .tox/test/lib/python3.14/site-packages/aiohttp/http.py:7: in <module> from .http_parser import ( .tox/test/lib/python3.14/site-packages/aiohttp/http_parser.py:29: in <module> from .compression_utils import ( .tox/test/lib/python3.14/site-packages/aiohttp/compression_utils.py:25: in <module> import compression.zstd # noqa: I900 ^^^^^^^^^^^^^^^^^^^^^^^ /opt/python/3.14/lib/python3.14/compression/zstd/__init__.py:29: in <module> import _zstd E ModuleNotFoundError: No module named '_zstd'

Minimal Reproduction

repro.py
import aiohttp .tox/test/lib/python3.14/site-packages/aiohttp/__init__.py:6: in <module> from .client import ( .tox/test/lib/python3.14/site-packages/aiohttp/client.py:40: in <module> from . import hdrs, http, payload .tox/test/lib/python3.14/site-packages/aiohttp/http.py:7: in <module> from .http_parser import ( .tox/test/lib/python3.14/site-packages/aiohttp/http_parser.py:29: in <module> from .compression_utils import ( .tox/test/lib/python3.14/site-packages/aiohttp/compression_utils.py:25: in <module> import compression.zstd # noqa: I900 ^^^^^^^^^^^^^^^^^^^^^^^ /opt/python/3.14/lib/python3.14/compression/zstd/__init__.py:29: in <module> import _zstd E ModuleNotFoundError: No module named '_zstd'

Environment

  • Python: 3.14

Fix Options (Details)

Option A — Apply the official fix

Prevent errors when using aiohttp from a Python 3.14 build that does not include compression.zstd support.

When NOT to use: This fix should not be used if zstd support is required for functionality.

Fix reference: https://github.com/aio-libs/aiohttp/pull/11611

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if zstd support is required for functionality.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
  • Pin production dependencies and upgrade only with a reproducible test that hits the failing path.

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.