The Fix
Upgrade to version 0.25.1 or later.
Based on closed encode/httpx issue #2890 · 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%.
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Add support for Python 3.12. (#2854)
+* Add support for httpcore 1.0 (#2885)
### Fixed
(.venv) E:\hcore1>python app.py
Traceback (most recent call last):
File "E:\hcore1\app.py", line 6, in main
r = await client.get('https://www.example.com/')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1757, in get
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1617, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_transports\default.py", line 366, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 224, in handle_async_request
async with self._pool_lock:
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 62, in __aenter__
self.setup()
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 55, in setup
raise RuntimeError(
RuntimeError: Running with asyncio requires installation of 'httpcore[asyncio]'.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\hcore1\app.py", line 8, in <module>
asyncio.run(main())
File "C:\Users\Tester\.rye\py\[email protected]\install\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\Tester\.rye\py\[email protected]\install\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Tester\.rye\py\[email protected]\install\Lib\asyncio\base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "E:\hcore1\app.py", line 5, in main
async with httpx.AsyncClient() as client:
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 2003, in __aexit__
await self._transport.__aexit__(exc_type, exc_value, traceback)
File "E:\hcore1\.venv\Lib\site-packages\httpx\_transports\default.py", line 345, in __aexit__
await self._pool.__aexit__(exc_type, exc_value, traceback)
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 327, in __aexit__
await self.aclose()
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 312, in aclose
async with self._pool_lock:
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 67, in __aenter__
await self._anyio_lock.acquire()
^^^^^^^^^^^^^^^^
AttributeError:
... (truncated) ...
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\nUpgrade to version 0.25.1 or later.\nWhen NOT to use: This fix is not applicable if anyio is intentionally removed for compatibility reasons.\n\n
Why This Fix Works in Production
- Trigger: (.venv) E:\hcore1>python app.py
- Mechanism: The AsyncLock in httpcore lacks the required attributes when anyio is not installed
- Why the fix works: Supports newer versions of httpcore, addressing compatibility issues with httpx. (first fixed release: 0.25.1).
- 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
- The AsyncLock in httpcore lacks the required attributes when anyio is not installed
- Surfaces as: (.venv) E:\hcore1>python app.py
Proof / Evidence
- GitHub issue: #2890
- Fix PR: https://github.com/encode/httpx/pull/2885
- First fixed release: 0.25.1
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.25
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Try install httpx + httpcore 1.0 then remove anyio. Error: _Originally posted by @T-256 in https://github.com/encode/httpx/pull/2885#discussion_r1356548422_”
Failure Signature (Search String)
- (.venv) E:\hcore1>python app.py
Error Message
Stack trace
Error Message
-------------
(.venv) E:\hcore1>python app.py
Traceback (most recent call last):
File "E:\hcore1\app.py", line 6, in main
r = await client.get('https://www.example.com/')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1757, in get
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1617, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
... (truncated) ...
Minimal Reproduction
(.venv) E:\hcore1>python app.py
Traceback (most recent call last):
File "E:\hcore1\app.py", line 6, in main
r = await client.get('https://www.example.com/')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1757, in get
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1617, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpx\_transports\default.py", line 366, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 224, in handle_async_request
async with self._pool_lock:
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 62, in __aenter__
self.setup()
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 55, in setup
raise RuntimeError(
RuntimeError: Running with asyncio requires installation of 'httpcore[asyncio]'.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\hcore1\app.py", line 8, in <module>
asyncio.run(main())
File "C:\Users\Tester\.rye\py\[email protected]\install\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\Tester\.rye\py\[email protected]\install\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Tester\.rye\py\[email protected]\install\Lib\asyncio\base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "E:\hcore1\app.py", line 5, in main
async with httpx.AsyncClient() as client:
File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 2003, in __aexit__
await self._transport.__aexit__(exc_type, exc_value, traceback)
File "E:\hcore1\.venv\Lib\site-packages\httpx\_transports\default.py", line 345, in __aexit__
await self._pool.__aexit__(exc_type, exc_value, traceback)
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 327, in __aexit__
await self.aclose()
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 312, in aclose
async with self._pool_lock:
File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 67, in __aenter__
await self._anyio_lock.acquire()
^^^^^^^^^^^^^^^^
AttributeError:
... (truncated) ...
What Broke
Users experience AttributeError when attempting to make asynchronous requests without anyio.
Why It Broke
The AsyncLock in httpcore lacks the required attributes when anyio is not installed
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.25.1 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/encode/httpx/pull/2885
First fixed release: 0.25.1
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if anyio is intentionally removed for compatibility reasons.
Verify Fix
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
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.25.1 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.