Skip to content

bug: Windows build fails silently in Flet 1.0.5 packaging stage and produces incomplete Python runtime (missing dependencies such as certifi) #7029

Open
flet-dev/serious-python
#262

Description

@nelson-python

Duplicate Check

Describe the bug

Environment:

OS:
Windows 11 25H2
Build 10.0.26200.9711

Python:
3.14.7

Flet:
1.0.5

flet-cli:
1.0.5

Flutter:
3.44.8 (stable)

Dart:
3.12.2

Visual Studio:
2022 Community 17.14.33

Android SDK:
36.1.0

Note: flutter doctor reports: No issues found.

Summary

flet build windows --python-version 3.14 -v fails with:

Error building Flet app - see the log of failed command above.

However, no failed command, exception, or traceback is shown.

The generated Flutter project builds successfully with:

flutter build windows -v

...and exits successfully.

The generated executable launches, but fails immediately with:

ModuleNotFoundError: No module named 'certifi'

...indicating that Python dependencies were never installed into the packaged runtime.

Code sample

Code
[Paste your code here]

To reproduce

Project

Python extension package:

TOML:

[project]
requires-python = ">=3.14,<3.15"

dependencies = [
"flet==1.0.5",
"httpx==0.28.1",
"certifi==2026.10.23",
]

Example application:

TOML:

dependencies = [
"test-extension-26",
"flet==1.0.5",
]

Flutter package:

YAML:

environment:
sdk: ">=3.12.2 <3.13.0"
flutter: ">=3.44.8 <3.45.0"

dependencies:
flutter:
sdk: flutter

flet: 1.0.5
image_painter: 0.7.1
fleather: 1.28.0
parchment: 1.27.0
display_metrics: 2.6.0

Build Command:

flet build windows --python-version 3.14 -v

Expected behavior

  1. Build completes successfully, installing all declared Python dependencies into the bundled runtime.

...or:

  1. Build fails with the underlying exception and full traceback.

Actual Behavior:

Build fails with a generic message:

Error building Flet app - see the log of failed command above.

...while:

  1. No actual failing command is displayed,
  2. No traceback is displayed,
  3. Generated Flutter project builds successfully,
  4. Bundled runtime is missing required dependencies.

Build output reaches:

_Running package command
Python 3.14 (CPython 3.14.7)

Compiling Python sources in a temp directory_

...and later:

flutter doctor
...
No issues found!

...but then ends with:

Error building Flet app - see the log of failed command above.

No actual failed command is shown.

Screenshots / Videos

Captures

[Upload media here]

Operating System

Windows

Operating system details

Windows 11

Flet version

1.0.5

Regression

No, it isn't

Suggestions

No response

Logs

build.log

Logs
[Paste your logs here]

Additional details

The generated Flutter project is fully created under:

build\flutter

...and can be built manually:

_cd build\flutter

flutter build windows -v_

Result:

Build succeeded.
0 Warning(s)
0 Error(s)

Packaged Runtime Missing Dependencies

Inside:

build\flutter\build\build_python_3.14.7\python

...the bundled runtime cannot import certifi:

python.exe -c "import certifi"

Output:

ModuleNotFoundError: No module named 'certifi'

Inspection of:

Lib\site-packages

...shows essentially only:

pip
pip-*.dist-info

...and none of the required runtime dependencies.

Expected packages such as:

certifi
httpx
oauthlib
repath
msgpack

...are absent.

Potentially Related Observation:

Verbose build output contains:

-r flet==1.0.5
-r test-extension-26 @ file:///C:/flutter/extension26
-r --no-cache-dir

The final entry appears suspicious:

-r --no-cache-dir

...as -r normally precedes a requirement specifier.

This may indicate malformed argument construction during the packaging step.

Activity

  1. nelson-python commented on Oct 31, 2026

    @nelson-python
    Author

    Possibly related to #6994.

    Observed symptom is nearly identical:

    • generated runtime missing third-party packages
    • ModuleNotFoundError: certifi
    • packaged site-packages largely empty

    Difference:
    Issue reproduced on Windows build path rather than APK build path.

    Nelson

  2. ndonkoHenri commented on Oct 31, 2026

    @ndonkoHenri
    Contributor

    Thanks for the detailed report and the log, they made this easy to pin down.

    The build stops at the step that pre-compiles your app's .py files (the python -m compileall line at the end of your log), before any dependencies are installed. That's why site-packages only holds pip, and why the app you built by hand with flutter build windows can't import certifi. The -r --no-cache-dir entry is expected: --no-cache-dir is passed through to pip.

    The compile step fails because one of the .py files in your app directory can't be compiled, usually because of a syntax error, or syntax that Python 3.14 doesn't accept. With -v, Flet doesn't show that error, which is a bug on our side.

    Workaround: run the build with -vv to see the error:

    flet build windows --python-version 3.14 -vv
    

    Right after the compileall line you'll find the file, the line number and a SyntaxError. Then either:

    • fix that file, or
    • if the file isn't part of your app (an old script, a scratch file), leave it out of the package with --exclude <path>, or with exclude under [tool.flet.app] in pyproject.toml.

    The next build then installs your dependencies as usual. If -vv shows something else, please attach that log.

    The fix is in flet-dev/serious-python#262: flet build will print the error without -vv.

  3. self-assigned this
    on Oct 31, 2026
  4. moved this from 👀 In review to 🔖 Ready in Flet Developmenton Oct 31, 2026
  5. nelson-python commented on Nov 1, 2026

    @nelson-python
    Author

    @ndonkoHenri

    As an update, the root cause was identified.

    The build failure was caused by an old Python file in my backup folder (for old versions of code) under the app source tree. Running with -vv revealed IndentationError in the old/archived file. After removing/moving the backup file outside the app path, the build completed successfully.

    The issue regarding hidden compile errors remains valid, and the fix in serious_python#262 appears to address the discoverability problem.

    Thank you,
    Nelson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions