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

Unable to start a minimal PyQt5 application on Big Sur #5324

Closed
6 tasks
devos50 opened this issue Nov 15, 2020 · 2 comments
Closed
6 tasks

Unable to start a minimal PyQt5 application on Big Sur #5324

devos50 opened this issue Nov 15, 2020 · 2 comments

Comments

@devos50
Copy link

devos50 commented Nov 15, 2020

Description of the issue

As the title says, I'm unable to start a basic PyQt5 application on Big Sur. Running the application does not render a GUI. The process seems to be busy and I have to force-quit the application to shut it down.

Context information (for bug reports)

  • Output of pyinstaller --version: 4.0 (I also tried it with the latest development version)

  • Version of Python: Python 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)] on darwin

  • Platform: macOS Big Sur

  • Did you also try this on another platform? Does it work there? Yes, it works on

  • try the latest development version, using the following command:

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

Make sure everything is packaged correctly

  • start with clean installation
  • use the latest development version
  • Run your frozen program from a command window (shell) — instead of double-clicking on it
  • Package your program in --onedir mode
  • Package without UPX, say: use the option --noupx or set upx=False in your .spec-file
  • Repackage you application in verbose/debug mode. For this, pass the option --debug to pyi-makespec or pyinstaller or use EXE(..., debug=1, ...) in your .spec file.

A minimal example program which shows the error

main.py script:

import sys
from PyQt5.QtWidgets import QApplication, QMainWindow

app = QApplication(sys.argv)
window = QMainWindow()
window.show()

app.exec_()

main.spec content:

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['main.py'],
             pathex=['/Users/martijndevos/Documents/pyqt_minimal'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=["tcl", 'tk', '_tkinter', 'tkinter', 'Tkinter'],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          [],
          exclude_binaries=True,
          name='main',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               upx_exclude=[],
               name='main')

I'm using PyQt5 5.15.0.

Stacktrace / full error message

None

Please also see https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs
for more about what would use to solve the issue.

@rokm
Copy link
Member

rokm commented Nov 15, 2020

I seem to be getting the exactly same behavior with un-frozen version of your application. So the issue here is not PyInstaller, but Qt5 and Big Sur.

Take a look at this - setting the QT_MAC_WANTS_LAYER=1 environment variables seems to do the trick, both for unfrozen and frozen version. You can set it either in the environment before launching the program, or at the top of your program using os.environ, i.e.:

import os
os.environ["QT_MAC_WANTS_LAYER"] = "1"

import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
...

@devos50
Copy link
Author

devos50 commented Nov 15, 2020

@rokm thank you for your response! I also did test it without PyInstaller and it seems to work correctly for me.

The workaround indeed seems to do the trick, thanks for linking that! With that, I consider this issue as resolved 👍

@devos50 devos50 closed this as completed Nov 15, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants