Open tokyohandsome opened 5 months ago
I can reproduce this issue by simply adding the numpy
import to a hello world file.
Works:
import flet as ft
def main(page: ft.Page):
page.add(ft.Text("Hello World!"))
ft.app(main)
Fails with crash after build:
import flet as ft
import numpy as np
def main(page: ft.Page):
page.add(ft.Text("Hello World!"))
ft.app(main)
As the reporter noted, this causes a crash, after which point, all apps in this project will render a blank page (no crash), even if you remove the dependency.
The app works with flet run
and even flet pack
suggesting there may be an issue with flet build
.
There is an explanation and workaround for "numpy on macos" issue: https://github.com/flet-dev/serious-python/issues/85#issuecomment-2065000974
Either re-build the app with flet build macos
(both 0.21.2 and 0.22.0 build templates where updated to set OPENBLAS_NUM_THREADS
variable or implement a fix in your own python app.
Great! Thank you, @FeodorFitsner ! I just tested building my app with 0.21.1 and 0.22.0 without modifying my code, and both built apps worked with no issue. Awesome!
Description Building Flet app with numpy completes with no error on mac, but built app crashes right after opening a window.
Code example to reproduce the issue:
Build command:
Describe the results you received:
Built app crashes right after rendering a window. Running the app by
python main.py
orflet run main.py
works fine. After commentingimport numpy as np
out, built app renders a window with no content. It won't crash.Describe the results you expected:
Random float something like
Value: 0.8875341508950007
appears on a window.Additional information you deem important (e.g. issue happens only occasionally):
App built by
flet pack main.py
won't crash and works as expected.Flet version (
pip show flet
):Give your
requirements.txt
file (don'tpip freeze
, instead give direct packages):Operating system:
ProductName: macOS ProductVersion: 14.3.1 BuildVersion: 23D60
M2 Max 12 core CPU + 30 core GPU 32GB RAM
Additional environment details: