You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: flet test fails with ModuleNotFoundError: No module named 'pydantic_core._pydantic_core' #7022
Originally posted by jules-baratoux October 28, 2026
Question
Hi,
I'm trying to run flet test, but the app fails to render not able to import Pydantic:
I'm not sure what I'm doing wrong. Is there something else I need to configure to make flet test work correctly on Windows when depending on pydantic?
Any help would be appreciated. Thanks!
Configuration
I tried adding the following configuration to my pyproject.toml, but it didn't solve the issue even after a prior flet clean:
[[tool.uv.index]]
name = "flet"url = "https://pypi.flet.dev"explicit = true
[tool.uv.sources]
pydantic-core = { index = "flet" }
Error message
File ".../site-packages/pydantic/version.py", line 7, in<module>
File ".../site-packages/pydantic_core/__init__.py", line 8, in<module>
ModuleNotFoundError: No module named 'pydantic_core._pydantic_core'
Note
Also, is there a way to capture the app log (not the test log) when running flet test? I had to rely on a sleep to read the error 😅
asyncdeftest_example(flet_app: ftt.FletTestApp):
awaitsleep(15) # Wait to be able to read the app errorassertFalse
Thanks, this matches what I reproduced: same Flet 1.0.5, same pydantic 2.14.1 / pydantic-core 2.50.1, same error.
The pydantic version shouldn't matter on Windows: flet test builds the app in Flutter's Debug mode, and on Windows that embeds a debug build of Python, which can only load compiled modules named *_d.pyd. The pydantic-core wheel from PyPI is installed correctly, but its .pyd is the regular release build, so the debug Python never loads it. Any package with compiled code fails the same way. If an older version worked for you, was it pydantic 1.x? It can run without its compiled module.
pypi.flet.dev only hosts Android and iOS wheels, so it isn't involved here. Windows uses the wheels from PyPI, and flet build already adds pypi.flet.dev for mobile builds. For Android or iOS you'd currently need pydantic==2.13.4, the newest release whose pydantic-core has mobile wheels there.
Thank you again for your prompt help and explanations. Unfortunately, I'm afraid I don't remember which version worked last night while I was trying to pin down the issue for reproduction.
Activity
jules-baratoux commentedon Oct 28, 2026
Thank you so much!
This was on
1.0.5from Windows.The version of
pydanticseems to matter.Code
Content of
src/main.pyContent of
tests/test_main.pyMore information
$ uv tree --package pydantic Resolved 82 packages in 1ms pydantic v2.14.1 ├── annotated-types v0.8.0 ├── pydantic-core v2.50.1 │ └── typing-extensions v4.16.0 ├── typing-extensions v4.16.0 └── typing-inspection v0.4.4 └── typing-extensions v4.16.0I don't see
pydantic-core v2.50.1in https://pypi.flet.dev/pydantic_core/ndonkoHenri commentedon Oct 29, 2026
Thanks, this matches what I reproduced: same Flet 1.0.5, same
pydantic2.14.1 /pydantic-core2.50.1, same error.The pydantic version shouldn't matter on Windows:
flet testbuilds the app in Flutter's Debug mode, and on Windows that embeds a debug build of Python, which can only load compiled modules named*_d.pyd. Thepydantic-corewheel from PyPI is installed correctly, but its.pydis the regular release build, so the debug Python never loads it. Any package with compiled code fails the same way. If an older version worked for you, was it pydantic 1.x? It can run without its compiled module.pypi.flet.dev only hosts Android and iOS wheels, so it isn't involved here. Windows uses the wheels from PyPI, and
flet buildalready adds pypi.flet.dev for mobile builds. For Android or iOS you'd currently needpydantic==2.13.4, the newest release whosepydantic-corehas mobile wheels there.Fixes:
flet test. Verified with your pydantic version.flet testfail right away with the Python traceback when the app can't start, so you won't need thesleepto see the error.jules-baratoux commentedon Oct 29, 2026
Thank you again for your prompt help and explanations. Unfortunately, I'm afraid I don't remember which version worked last night while I was trying to pin down the issue for reproduction.