Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac DMG quits immediately after opening #1

Closed
mdegenero opened this issue Aug 7, 2020 · 9 comments
Closed

Mac DMG quits immediately after opening #1

mdegenero opened this issue Aug 7, 2020 · 9 comments

Comments

@mdegenero
Copy link

Hi @maltfield --

I ran the application through to create executables, but when I tried to open the dmg from helloWorld-mac-x86_64, it immediately quits after opening. It doesn't look like there were any errors outputted with the PyInstaller command. Do you know what might be causing this issue?

My project contains two python files and a .kv file, as well as a few .pngs. I can upload any relevant logs or files, if that will help.

@maltfield
Copy link
Owner

maltfield commented Aug 8, 2020

It quits after opening the .dmg or the .app? It can happen after opening the .app from the GUI. My best-guess is that it's an issue with (lack of) notarization.

What version of MacOS are you running?

Please link me to the relevant GitHub Actions output.

Try opening the executable directly using the command-line to see if it produces additional output.

open -W helloWorld.dmg
open -W /Volumes/helloWorld/helloWorld.app/Contents/MacOS/helloWorld

@maltfield
Copy link
Owner

maltfield commented Aug 8, 2020

Wait, where's your python files? You need a main.py at least..

If you want another example to look at how your src/ dir should be, see

@mdegenero
Copy link
Author

My bad, I had made a few changes and forgot to re-upload. Just ran through the Actions again: https://github.com/mdegenero/cross-platform-python-gui/runs/962485463?check_suite_focus=true

When I try to open helloWorld.app, I get the following error:

File "virtual_ensemble.py", line 38, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'

@maltfield
Copy link
Owner

I see you've already added numpy to your requirements.txt file, and the output from the Actions you linked-to shows that it is being installed.

What I don't understand is why both main.py and virtual_ensemble.py import numpy, yet the error you get is only for virtual_ensemble.py, which--if numpy is truly missing--it should error-out on main.py first.

PyInstaller should clearly be able to find your numpy imports, but try adding it explicitly by adding it to hiddenimports

Change

hiddenimports=['pkg_resources.py2_warn'],

to

hiddenimports=['pkg_resources.py2_warn', 'numpy'],

If that doesn't work, try googling for PyInstaller issues and this error message. If you find a solution, please post back here so others can benefit from it.

@mdegenero
Copy link
Author

I added the line "pip install --user --upgrade --force-reinstall numpy" to the buildDmg.sh file and that seemed to get rid of the numpy error. I am now getting a similar error, but for matplotlib:

"ModuleNotFoundError: No module named 'matplotlib'"

@mdegenero
Copy link
Author

mdegenero commented Aug 11, 2020

So, I got the same "ModuleNotFoundError" for all of my Python imports; so I added the --force-reinstall command for all of those imports, manually, in the buildDmg.sh file. I am now getting the following error:

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    import virtual_ensemble as vmet
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/Users/runner/Library/Python/3.8/lib/python/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
  File "virtual_ensemble.py", line 51, in <module>
    import moviepy.editor as mp
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/Users/runner/Library/Python/3.8/lib/python/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
  File "moviepy/editor.py", line 60, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/Users/runner/Library/Python/3.8/lib/python/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
  File "moviepy/video/io/sliders.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/Users/runner/Library/Python/3.8/lib/python/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
  File "matplotlib/__init__.py", line 898, in <module>
  File "matplotlib/cbook/__init__.py", line 480, in _get_data_path
  File "matplotlib/__init__.py", line 239, in wrapper
  File "matplotlib/__init__.py", line 534, in get_data_path
  File "matplotlib/__init__.py", line 239, in wrapper
  File "matplotlib/__init__.py", line 563, in _get_data_path
NameError: name 'defaultParams' is not defined

@maltfield
Copy link
Owner

added the line "pip install --user --upgrade --force-reinstall numpy" to the buildDmg.sh file and that seemed to get rid of the numpy error

I updated the buildDmg.sh script to use the --force-reinstall command when installing the depends listed in requirements.txt -- please test to see if this fixes your issues without having to add your modules one-by-one to the buildDmg.sh file

ec275a1#diff-5a0e140a72dc4932aaac93f01edb0b62R66

@maltfield
Copy link
Owner

NameError: name 'defaultParams' is not defined

As for this, first confirm that your code itself doesn't have errors by running pythonX main.py before the build.

And if this is PyInstaller-specific, then please search the internet for the error and update this ticket with your findings for the benefit of others

@maltfield
Copy link
Owner

maltfield commented Aug 23, 2020

Closing this. Please re-open if this is indeed an issue with this repo.

And please add comments if you solved your issues with PyInstaller/matplotlib

darpan5552 added a commit to darpan5552/cross-platform-python-gui that referenced this issue Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants