Can't run macOS binary after packaging

58 views
Skip to first unread message

Elliott Balsley

unread,
Sep 16, 2020, 2:57:48 AM9/16/20
to PyInstaller
I was previously running Python 3.7 from MacPorts with Pyinstaller 4.0 from pypi and this was working fine.  But after reading about Tkinter and Cocoa, I decided to wipe that away and install Python 3.7 from python.org instead.  Now Pyinstaller isn't working.  This is probably due to some configuration issue with my paths, but I would appreciate any advice.  I've removed all references to MacPorts Python that I can think of.

Inside a new venv I run

I make a very simple python script called bonk.py with just a single print statement.  Pyinstaller packages with no errors in onedir mode.  Here is the error when I try to run it:

$ ./dist/bonk/bonk 
[2616] Error loading Python lib '/Users/elliott/source/test1/dist/bonk/Python': dlopen: dlopen(/Users/elliott/source/test1/dist/bonk/Python, 10): no suitable image found.  Did find:
/Users/elliott/source/test1/dist/bonk/Python: code signature invalid for '/Users/elliott/source/test1/dist/bonk/Python'

There seems to be something wrong with the binary:
$ ./dist/bonk/Python 
-bash: ./dist/bonk/Python: cannot execute binary file

Some more details:
$ which python
/Users/elliott/source/test1/env/bin/python
$ python --version
Python 3.7.9


Michael O'Donnell

unread,
Oct 8, 2020, 6:05:02 AM10/8/20
to PyInstaller
I have the same problem, both with Python 3.7.9 and Pyinstaller 4.0, and also with Python 3.8.6 and Pythinstaller 4.1.dev0.

I signed my app first, using codesign --deep, but it is the Python exe within the app that gives the error.

Has anyone solved this problem?

Mick

Michael O'Donnell

unread,
Oct 9, 2020, 9:34:22 AM10/9/20
to PyInstaller
I went back to Python 3.7.3 (still with Pythinstaller 4.1.dev0) and the problem disappeared. Seems later versions of Python after 3.7.6 are problematic.

Mick

Nico Zanferrari

unread,
Dec 7, 2020, 2:51:06 AM12/7/20
to PyInstaller
Hi,

there is an explanation and even a workaround now, see https://github.com/pyinstaller/pyinstaller/issues/5062

Nico

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/fcebe13d-996e-4fdc-a57e-4d76b933456an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages