SAMBERPE10683 | 2021-04-09 17:57:30 UTC | #1
Hi Guys!
Can someone recommend the easiest way to deploy a pyqt program on a mac? I thought that py2app was the way to go but have spent the last two days failing. I stripped out ALL my code to the barest of bones (see below) but although it runs in Alias mode and seems to build a "redistributable" OK. It consistently crashes (program has "quit unexpectedly"). See below.
All my code does is load a ui function & displays it (and YES, I did remember to add the ui file to the setup.py file before running "python setup.py py2app".
Could it be that maybe my fancy (sorta) new-ish M1 ARM Macbook Air is causing the trouble? Do I need to force Rosetta emulation? I'm using py2app 0.23. Mac OS 11.2.3 Big Sur Python 3.8.8
I must say that it is VERY frustrating to get your program working and NOT being able to deliver it! I'm going to try with python 3.7, 3.6, & 3.5 before trying fbs again and then..... I may have to give up on python GUI stuff (and go back to Matlab) if I can't deploy.
I apologize since this isn't really about pyqt but I'm a desperate man.
Packaging Python Applications with PyInstaller by Martin Fitzpatrick — This step-by-step guide walks you through packaging your own Python applications from simple examples to complete installers and signed executables.
TIA,
Dan
############# SIMPLE CODE
import sys from PyQt5 import QtWidgets as qtw from PyQt5 import uic
Ui_LoginForm, baseClass = uic.loadUiType('test.ui')
class MainWindow(baseClass):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Create the GUI by processing qt designer file
self.ui = Ui_LoginForm()
self.ui.setupUi(self)
# Show
self.show()
#----------------------------------------------------------------------------- ############################################################################## if name == 'main': app = qtw.QApplication(sys.argv) w = MainWindow() sys.exit(app.exec_())
Crash Report: Process: test_py2app1 [5883] Path: /Users/USER/*/test_py2app1.app/Contents/MacOS/test_py2app1 Identifier: org.pythonmac.unspecified.test_py2app1 Version: ??? Code Type: X86-64 (Translated) Parent Process: ??? [1] Responsible: test_py2app1 [5883] User ID: 501
Date/Time: 2021-04-09 13:33:05.467 -0400 OS Version: macOS 11.2.3 (20D91) Report Version: 12 Anonymous UUID: 7B2BBD14-3FBF-0466-975E-86968FC3233F
SAMBERPE10683 | 2021-04-09 19:48:41 UTC | #2
OK.... Never mind! I THINK I got it working. The problem apparently had something to do with anaconda. I created a virtual environment with "python -m venv DanEnv", pip installed everything, and ran all the usual py2app commands and it appears to run OK (at least on my Mac).
Dan