Inconsistent performance in Windows build has been observed. There are 3 scenarios after running the executable file.
- UI Loads instantly
- UI loads after a waiting for a few seconds
- UI does not load even after 10 seconds. (seems like app has been crashed)
There is no way to sense the reason behind this behavior. This happens for as simple code as following:
import datetime
import flet as ft
def notify_user(e):
pass
async def main(page: ft.Page):
tool_column = ft.Column([ft.Text("HELLO")])
page.add(
tool_column
)
ft.app(main)
The app is build with the following command.
flet build windows --project sample--module-name app.py --output build --verbose
OS : Windows 11
Python: 3.12.4
Flet: 0.23.2
Flutter: 3.22.3
The build is also tested in other desktops. The behavior was same.
I observe the same situation.
In demonstrating this problem, the program was build using "flet build windows" command, there were no errors during assembly, the code was taken from the example.
https://github.com/user-attachments/assets/2714be92-4d20-4f74-b6fa-d7005266d146
Possibly related issue for regular execution/start in Windows (Windows 10, Python 32 Bit, Python 3.10.11).
- no influence by Windows Defender
- no influence by Windows Firewall
- no influence with fresh Python Installation
Very slow execution (~10..12s) in case of:
import flet (even for simple applications) or
"flet --version" command on commandline
Random manual interruption will lead to C:\env\Python310-32\lib\site-packages\flet\core\icons.py, which therefore consumes A LOT of processing time. in our case.
Update: if strongly reducing the number of icons in core\icons.py (from ~17000ish to a few), start time decreases strongly (as one would expect). Maybe flet needs another definition of item handling/loading or create precompiled structures for this case. Startup can be reduced to 0.5s.
The issue started (in our case) with an update to newest version, and was not observed previously. Revert to older versions did not help.
C:\Users\PRODAT>flet --version
Traceback (most recent call last):
File "C:\env\Python310-32\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\env\Python310-32\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\env\Python310-32\Scripts\flet.exe_main.py", line 4, in
File "C:\env\Python310-32\lib\site-packages\flet_init.py", line 1, in
from flet.app import app, app_async
File "C:\env\Python310-32\lib\site-packages\flet\app.py", line 12, in
from flet.core.page import Page
File "C:\env\Python310-32\lib\site-packages\flet\core\page.py", line 32, in
from flet.core.adaptive_control import AdaptiveControl
File "C:\env\Python310-32\lib\site-packages\flet\core\adaptive_control.py", line 3, in
from flet.core.control import Control
File "C:\env\Python310-32\lib\site-packages\flet\core\control.py", line 18, in
from flet.core.badge import Badge, BadgeValue
File "C:\env\Python310-32\lib\site-packages\flet\core\badge.py", line 5, in
from flet.core.text_style import TextStyle
File "C:\env\Python310-32\lib\site-packages\flet\core\text_style.py", line 5, in
from flet.core.box import BoxShadow
File "C:\env\Python310-32\lib\site-packages\flet\core\box.py", line 6, in
from flet.core.border import Border
File "C:\env\Python310-32\lib\site-packages\flet\core\border.py", line 5, in
from flet.core.types import ColorValue, OptionalNumber
File "C:\env\Python310-32\lib\site-packages\flet\core\types.py", line 28, in
from flet.core.icons import Icons, icons
File "C:\env\Python310-32\lib\site-packages\flet\core\icons.py", line 29, in
class icons(str, Enum, metaclass=IconsDeprecated):
File "C:\env\Python310-32\lib\enum.py", line 302, in new
if canonical_member.value == enum_member.value:
KeyboardInterrupt
^C
C:\Users\PRODAT>flet --version
Traceback (most recent call last):
File "C:\env\Python310-32\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\env\Python310-32\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\env\Python310-32\Scripts\flet.exe_main.py", line 4, in
File "C:\env\Python310-32\lib\site-packages\flet_init.py", line 1, in
from flet.app import app, app_async
File "C:\env\Python310-32\lib\site-packages\flet\app.py", line 12, in
from flet.core.page import Page
File "C:\env\Python310-32\lib\site-packages\flet\core\page.py", line 32, in
from flet.core.adaptive_control import AdaptiveControl
File "C:\env\Python310-32\lib\site-packages\flet\core\adaptive_control.py", line 3, in
from flet.core.control import Control
File "C:\env\Python310-32\lib\site-packages\flet\core\control.py", line 18, in
from flet.core.badge import Badge, BadgeValue
File "C:\env\Python310-32\lib\site-packages\flet\core\badge.py", line 5, in
from flet.core.text_style import TextStyle
File "C:\env\Python310-32\lib\site-packages\flet\core\text_style.py", line 5, in
from flet.core.box import BoxShadow
File "C:\env\Python310-32\lib\site-packages\flet\core\box.py", line 6, in
from flet.core.border import Border
File "C:\env\Python310-32\lib\site-packages\flet\core\border.py", line 5, in
from flet.core.types import ColorValue, OptionalNumber
File "C:\env\Python310-32\lib\site-packages\flet\core\types.py", line 28, in
from flet.core.icons import Icons, icons
File "C:\env\Python310-32\lib\site-packages\flet\core\icons.py", line 29, in
class icons(str, Enum, metaclass=IconsDeprecated):
File "C:\env\Python310-32\lib\enum.py", line 302, in new
if canonical_member.value == enum_member.value:
KeyboardInterrupt
^C
C:\Users\PRODAT>flet --version
Traceback (most recent call last):
File "C:\env\Python310-32\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\env\Python310-32\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\env\Python310-32\Scripts\flet.exe_main.py", line 4, in
File "C:\env\Python310-32\lib\site-packages\flet_init.py", line 1, in
from flet.app import app, app_async
File "C:\env\Python310-32\lib\site-packages\flet\app.py", line 12, in
from flet.core.page import Page
File "C:\env\Python310-32\lib\site-packages\flet\core\page.py", line 32, in
from flet.core.adaptive_control import AdaptiveControl
File "C:\env\Python310-32\lib\site-packages\flet\core\adaptive_control.py", line 3, in
from flet.core.control import Control
File "C:\env\Python310-32\lib\site-packages\flet\core\control.py", line 18, in
from flet.core.badge import Badge, BadgeValue
File "C:\env\Python310-32\lib\site-packages\flet\core\badge.py", line 5, in
from flet.core.text_style import TextStyle
File "C:\env\Python310-32\lib\site-packages\flet\core\text_style.py", line 5, in
from flet.core.box import BoxShadow
File "C:\env\Python310-32\lib\site-packages\flet\core\box.py", line 6, in
from flet.core.border import Border
File "C:\env\Python310-32\lib\site-packages\flet\core\border.py", line 5, in
from flet.core.types import ColorValue, OptionalNumber
File "C:\env\Python310-32\lib\site-packages\flet\core\types.py", line 28, in
from flet.core.icons import Icons, icons
File "C:\env\Python310-32\lib\site-packages\flet\core\icons.py", line 29, in
class icons(str, Enum, metaclass=IconsDeprecated):
File "C:\env\Python310-32\lib\enum.py", line 302, in new
if canonical_member.value == enum_member.value:
KeyboardInterrupt
^C