The Fix
pip install pydantic==2.12.0
Based on closed pydantic/pydantic issue #9012 · 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%.
@@ -36,6 +36,7 @@ run_mypy_on_file.py
# Documentation files
/docs/changelog.md
+/docs/*.whl
/docs/theme/mkdocs_run_deps.html
/site/
# /// script
# dependencies = ["logfire", "pydantic_ai_slim[openai]"]
# ///
# This example demonstrates Pydantic AI running with OpenAI!
from pydantic_ai import Agent
import logfire
# configure logfire
logfire.configure(token='__YOUR_LOGFIRE_WRITE_TOKEN__')
logfire.instrument_pydantic_ai()
agent = Agent('openai:gpt-4o')
result = await agent.run(
'How does pyodide let you run Python in the browser? (short answer please)'
)
print(f'output: {result.output}')
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install pydantic==2.12.0\nWhen NOT to use: This fix should not be used if the documentation examples are not intended for production use.\n\n
Why This Fix Works in Production
- Trigger: Error starting Python: PythonError: Traceback (most recent call last):
- Mechanism: The documentation plugin fails to detect the latest version of pydantic due to missing wheel builds
- Why the fix works: Fixes the documentation plugin for running code examples in the dev branch, addressing issues with wheel builds for pydantic. (first fixed release: 2.12.0).
- 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.11 in real deployments (not just unit tests).
- The documentation plugin fails to detect the latest version of pydantic due to missing wheel builds
- Surfaces as: Error starting Python: PythonError: Traceback (most recent call last):
Proof / Evidence
- GitHub issue: #9012
- Fix PR: https://github.com/pydantic/pydantic/pull/12322
- First fixed release: 2.12.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.35
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Yes @Viicos I was referring to pydantic.run but I checked it again and it works us you said”
“I took a brief look at this”
“Probably this is not totally related but I had a similar issue when I was trying the examples of logfire”
“Hi, I've read through the issue and the analysis by @sydney-runkle. As this is still open and unassigned, I'd like to try and tackle it.…”
Failure Signature (Search String)
- Error starting Python: PythonError: Traceback (most recent call last):
Error Message
Stack trace
Error Message
-------------
Error starting Python: PythonError: Traceback (most recent call last):
File "/lib/python3.11/site-packages/micropip/_micropip.py", line 576, in install
await transaction.gather_requirements(requirements)
File "/lib/python3.11/site-packages/micropip/_micropip.py", line 342, in gather_requirements
await gather(*requirement_promises)
File "/lib/python3.11/site-packages/micropip/_micropip.py", line 349, in add_requirement
return await self.add_requirement_inner(Requirement(req))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python3.11/site-packages/micropip/_micropip.py", line 444, in add_requirement_inner
wheel = find_wheel(metadata, req)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python3.11/site-packages/micropip/_micropip.py", line 312, in find_wheel
raise ValueError(
ValueError: Can't find a pure Python 3 wheel for 'pydantic==2.7.0a1'.
See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel
You can use `micropip.install(..., keep_going=True)`to get a list of all packages with missing wheels.
Stack trace
Error Message
-------------
Traceback (most recent call last):
File "/tmp/pydantic_run/_prepare_env.py", line 104, in prepare_env
await micropip.install(install_dependencies, keep_going=True)
File "/lib/python3.12/site-packages/micropip/package_manager.py", line 146, in install
return await install(
^^^^^^^^^^^^^^
File "/lib/python3.12/site-packages/micropip/install.py", line 56, in install
raise ValueError(
ValueError: Can't find a pure Python 3 wheel for: 'pydantic-core==2.33.2'
See: https://pyodide.org/en/stable/usage/faq.html#why-can-t-micropip-find-a-pure-python-wheel-for-a-package
Minimal Reproduction
# /// script
# dependencies = ["logfire", "pydantic_ai_slim[openai]"]
# ///
# This example demonstrates Pydantic AI running with OpenAI!
from pydantic_ai import Agent
import logfire
# configure logfire
logfire.configure(token='__YOUR_LOGFIRE_WRITE_TOKEN__')
logfire.instrument_pydantic_ai()
agent = Agent('openai:gpt-4o')
result = await agent.run(
'How does pyodide let you run Python in the browser? (short answer please)'
)
print(f'output: {result.output}')
Environment
- Python: 3.11
What Broke
Users cannot run documentation examples, leading to confusion and potential loss of trust in the library.
Why It Broke
The documentation plugin fails to detect the latest version of pydantic due to missing wheel builds
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.12.0
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/pydantic/pydantic/pull/12322
First fixed release: 2.12.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the documentation examples are not intended for production use.
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 |
|---|---|
| 2.12.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.