Open jsheunis opened 2 years ago
Current status update
Trying to use PyInstaller
with minimal settings to create a mac app bundle that can be packaged into a distributable .dmg
file. Progress here: https://github.com/jsheunis/datalad-gooey/tree/mac-app
The main components are:
cli.py
)datalad-gooey.spec
file for PyInstaller
datalad_gooey_logo.icns
)Then after installing PyInstaller
(pip3 install --upgrade PyInstaller pyinstaller-hooks-contrib
) in a virtual environment, I run the following:
pyinstaller datalad-gooey.spec
This process executes successfully. But when I double click on the resulting bundle, the app icon appears shortly in the task bar, and then disappears.
Running open ./dist/datalad-gooey.app/Contents/MacOs/datalad-gooey
from the repo's root directory opens up a terminal and yields the following output:
/Users/jsheunis/Documents/psyinf/datalad-gooey-jsh/dist/datalad-gooey.app/Contents/MacOS/datalad-gooey ; exit;
Traceback (most recent call last):
File "cli.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
File "datalad_gooey/app.py", line 48, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
File "datalad_gooey/dataladcmd_ui.py", line 21, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
File "datalad_gooey/param_form_utils.py", line 28, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
File "datalad_gooey/active_suite.py", line 51, in <module>
RuntimeError: No active Gooey suite 'gooey-simplified'! Imploding...
[60462] Failed to execute script 'cli' due to unhandled exception: No active Gooey suite 'gooey-simplified'! Imploding...
I looked into PyInstaller
docs and read a bit about hidden imports and datas and hooks. Without understanding much, I added datalad
, datalad-gooey
and datalad-gooey.simplified_api
to hiddenimports
but that didn't solve the problem. I'm thinking it has something to do with PyInstaller
not recognizing the specified entry points in setup.cfg
:
datalad.gooey.suites =
gooey-simplified = datalad_gooey.simplified_api:gooey_suite
gooey-complete = datalad_gooey.complete_api:gooey_suite
But at the moment I am a bit clueless as to how to approach this.
Lastly, another challenge would be to ensure that the distributable mac installer also somehow installs git and git-annex. I don't have any ideas about this yet, other than having superficially looked at the hooks functionality of PyInstaller
, as well as the binaries
that can be specified in the .spec
file. But I don't have useful ideas about how these would be implemented and executed.
Some things to try:
cli.py
could be wrong. Perhaps execute the datalad gooey
cli command, Qt app's main
doesn't know what to import.cli.py
try using datalad-gooey
which already installed?
https://www.pythonguis.com/tutorials/packaging-pyside6-applications-pyinstaller-macos-dmg/