bug: `flet run --web` fails with `TypeError: ... unexpected keyword argument 'openapi_prefix'` on FastAPI 0.145+
Maintainer thường phản hồi trong vòng 2 ngày
Một pull request liên quan đã được merge.
- #6988 của @ndonkoHenri — đã merge
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Bắt đầu với traceback tại flet_web/fastapi/flet_fastapi.py:117 và kiểm tra phiên bản dependency FastAPI được cài đặt bởi pip install 'flet[all]' trên Python 3.13. Lỗi được báo cáo là đối số openapi_prefix không mong đợi khi flet run --web tạo ứng dụng FastAPI; hãy xác nhận hành vi tương thích của dependency và tái hiện lỗi bằng ví dụ chat trên Debian 13 aarch64. Công việc hoàn tất khi ứng dụng khởi động và tải được trong trình duyệt trên cấu hình đã báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
I have a locally hosted Flet application on a raspberry pi running headless raspberry pi os, but when I run the application using flet run --web, I receive this error:
Traceback (most recent call last):
File "/path/to/python/flet_apps/src/main.py", line 26, in <module>
ft.run(main)
~~~~~~^^^^^^
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 133, in run
return asyncio.run(
~~~~~~~~~~~^
run_async(
^^^^^^^^^^
...<11 lines>...
)
^
)
^
File "/usr/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 282, in run_async
conn = await __run_web_server(
^^^^^^^^^^^^^^^^^^^^^^^
...<11 lines>...
)
^
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 627, in __run_web_server
return await serve_fastapi_web_app(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<13 lines>...
)
^
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet_web/fastapi/serve_fastapi_web_app.py", line 129, in serve_fastapi_web_app
app = flet_web.fastapi.FastAPI(on_startup=[startup])
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet_web/fastapi/flet_fastapi.py", line 117, in __init__
super().__init__(
~~~~~~~~~~~~~~~~^
debug=debug,
^^^^^^^^^^^^
...<33 lines>...
**extra,
^^^^^^^^
)
^
TypeError: FastAPI.__init__() got an unexpected keyword argument 'openapi_prefix'
Code sample
Code
I used the given chat application example
To reproduce
- On a headless Linux system, create a folder and enter into it
- Create a Python virtual env,
python -m venv .venv - Activate the virtual env,
source .venv/bin/activate - Install flet,
pip install 'flet[all]' - Run
flet create - Copy the chat example and replace it with the contents of
src/main.py
Expected behavior
Expect to see the app load in the browser
Screenshots / Videos
Captures
Operating System
Linux
Operating system details
Debian GNU/Linux 13 (trixie) aarch64
Flet version
1.0.4
Regression
Yes, it used to work in a previous Flet version (please specify the version in additional details)
Suggestions
I suspect the reason the issue is arising is due to the fact that the web/ directory is missing in the .venv/lib/python3.13/site-packages/flet_web/ folder. Is the directory not present have to do with the fact that Raspberry Pi OS is running headless? My daily laptop does have that web/ directory present and flet run --web works fine.
Logs
Logs
Traceback (most recent call last):
File "/path/to/python/flet_apps/src/main.py", line 26, in <module>
ft.run(main)
~~~~~~^^^^^^
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 133, in run
return asyncio.run(
~~~~~~~~~~~^
run_async(
^^^^^^^^^^
...<11 lines>...
)
^
)
^
File "/usr/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 282, in run_async
conn = await __run_web_server(
^^^^^^^^^^^^^^^^^^^^^^^
...<11 lines>...
)
^
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet/app.py", line 627, in __run_web_server
return await serve_fastapi_web_app(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<13 lines>...
)
^
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet_web/fastapi/serve_fastapi_web_app.py", line 129, in serve_fastapi_web_app
app = flet_web.fastapi.FastAPI(on_startup=[startup])
File "/path/to/python/flet_apps/.venv/lib/python3.13/site-packages/flet_web/fastapi/flet_fastapi.py", line 117, in __init__
super().__init__(
~~~~~~~~~~~~~~~~^
debug=debug,
^^^^^^^^^^^^
...<33 lines>...
**extra,
^^^^^^^^
)
^
TypeError: FastAPI.__init__() got an unexpected keyword argument 'openapi_prefix'
Additional details
No response
- Ngôn ngữ chính
- Python
- Star
- 17.4k
- Fork
- 728
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 54
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của flet-dev/flet
-
feature: python 3.15 supportĐang mởfeature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
flet-dev/flet#6985 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
flet build: common [tool.flet.deep_linking] is ignored on Android and iOSCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug packaging platform: mobile
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug: `flet test` on freshly created project fails on Windows with an empty windowCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của flet-dev/flet
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
WLAN-Pi/wlanpi-profiler#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Memory leak: the shared `validation_aborted_error` keeps every traceback it is raised throughCó thể đã có người làm @Fire162 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
graphql-python/graphql-core#287 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
roman-corgi/ctc-dip#160 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
render_findings.py reads and writes in the host's default encoding, so findings.html breaks on a cp1252 Windows hostCó thể đã có người làm @Aaqibhafeezkhan đã nhận hôm nay. Đang mởbug good first issue mentored python size: XS up-for-grabs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
dheerajjha/mcp-migrate#366 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày