packaging missing some modules #5061
-
First Check
Example Codenicegui-pack --onefile --name "myapp" main.py DescriptionHi everyone! I have encountered a problem when building an exe file of my app. Issue is when the exe file is built i get error:
I tried to add hidden imports into spec file and run it from pyinstaller command directly. It didn't work
is there any ideas on that? NiceGUI Version2.21.1 Python Version3.11.9 BrowserChrome, Edge Operating SystemWindows Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @golgitab, GPT-5 says: Yep—this is a classic PyInstaller packaging hiccup, not a NiceGUI issue. Why it happens
Two solid fixes1) Do it all from the command line (quickest)Use PyInstaller’s collection flags to include the metadata, data files, and any dynamically imported submodules: pyinstaller \
--onefile \
--name myapp \
--copy-metadata tortoise-orm \
--collect-submodules tortoise \
--collect-data tortoise \
main.py That’s usually enough. Keep your current 2) Put it into your
|
Beta Was this translation helpful? Give feedback.
Hi @golgitab, GPT-5 says:
Yep—this is a classic PyInstaller packaging hiccup, not a NiceGUI issue.
Why it happens
tortoise-orm
(PyPI distribution name) provides package metadata thatimportlib.metadata
reads at runtime. In a one-file PyInstaller build, that metadata isn’t bundled by default, soimportlib.metadata.distribution("tortoise-orm")
fails with:Two solid fixes
1) Do it all from the command line (quickest)
Use PyInstaller’s collection flags to include the metadata, data files, and any dynamically imported submodules: