Using fbs to compile PyQt5 python GUI into a runnable app. Running Mac M1 v12.6. Of course, this is my first python GUI, so I'm sure I'm doing something wrong here.
fbs run
launches the program without issue. Everything works.
fbs freeze
finishes successfully. But, running the binary generated in /target
always results in zsh: segmentation fault
.
The program seems to fail when creating ApplicationContext()
. Testing this:
if __name__ == '__main__':
print( 'Hope for earth!' )
appctxt = ApplicationContext()
print( 'Salvation!' )
window = Window()
window.show()
exit_code = appctxt.app.exec_()
sys.exit(exit_code)
When running in IDE (PyCharm CE) or with fbs run
, I get sweet sweet Salvation!
. When running the binary, I get only Hope for earth!
.
I create main
as described in the fbs tutorial, here: https://github.com/mherrmann/fbs-tutorial
The troubleshooting page (https://build-system.fman.io/troubleshooting) suggests to run freeze with a debug flag to check for errors:
fbs clean
fbs freeze --debug
Full output has a couple of warnings, but no exceptions or errors.
All testing is done with a fresh and active conda environment in Python 3.6. The only packages installed:
conda install pyserial
pip install pyqt5 fbs
Also tried to run the binary when freezing an alternate version of main
:
if __name__ == '__main__':
print( 'Close, but...' )
app = QApplication(sys.argv)
print( 'no cigar!' )
window = Window()
window.show()
sys.exit(app.exec_())
Again - this runs with fbs run
, but fails at QApplication
using the binary from fbs freeze
.
This is an issue with pyinstaller included with fbs. Unfortunately, fbs is limited to python 3.6.
When running pyinstaller for python 3.6 (not part of fbs),
pyinstaller my_app.py
throws many errors related tolibSystem.B.dylib
. Not sure why I don't see these errors while packinging with fbs.Running
pyinstaller my_app.py
(not part of fbs) with python 3.9 or 3.10 compiles everything just fine.