I have never used pyinstaller
before and I’m running into problems building an executable with all the required sub-modules.
My app structure looks like this
--main_app
--ui_app.py (PYQT6)
--core.py
--modules
-- module_a.py
-- module_b.py
-- truncated
--utilities
-- module_a.py
-- module_b.py
-- truncated
I build the pyinstaller
application with the following command:
pyinstaller –onefile –name “Another Test” –upx-dir=/usr/local/Cellar/upx/4.1.0/bin
–paths=/Users/my_name/Python_Projects/my_project_name/main_app/modules/
–paths=/Users/my_name/Python_Projects/my_project_name/main_app/utilities/
–paths=/Users/my_name/Python_Projects/my_project_name/main_app/core.py
–windowed main_app/ui_app.py
When I try to run the application I receive warnings about modules
and utilities
not being found.
Traceback (most recent call last):
File "main_app/ui_app.py", line 48, in <module>
ModuleNotFoundError: No module named 'modules'
[43895] Failed to execute script 'ui_app' due to unhandled exception: No module named 'modules'
[43895] Traceback:
Traceback (most recent call last):
File "main_app/ui_app.py", line 48, in <module>
ModuleNotFoundError: No module named 'modules'
My import paths in ui_app.py
look like this:
from modules.file_handling import FileImporter, DataExporter
from modules.query_threaded import QueryRunnable, QueryResultHandler
from utilities.hover_buttons import HoverButton
from utilities.custom_dialogs import CustomDialog
How can I modify the pyinstaller
command or my code to fix the module not found warnings?