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 freeze minimal QWebEngineView app #8184

Open
giumas opened this issue Dec 28, 2023 · 4 comments
Open

Unable to freeze minimal QWebEngineView app #8184

giumas opened this issue Dec 28, 2023 · 4 comments
Labels
triage Please triage and relabel this issue

Comments

@giumas
Copy link
Contributor

giumas commented Dec 28, 2023

Description of the issue

I am attempting to move from PySide2 to PySide6, but I cannot manage to freeze the app when using QWebEngineView.

Context information (for bug reports)

  • Output of pyinstaller --version: 6.3.0
  • Version of Python: 3.12.1
  • Platform: Windows 10 Pro 22H2
  • Pip list:
    • altgraph 0.17.4
    • packaging 23.2
    • pefile 2023.2.7
    • pip 23.2.1
    • pyinstaller 6.3.0
    • pyinstaller-hooks-contrib 2023.11
    • PySide6 6.6.1
    • PySide6-Addons 6.6.1
    • PySide6-Essentials 6.6.1
    • pywin32-ctypes 0.2.2
    • setuptools 69.0.3
    • shiboken6 6.6.1
  • How you installed Python: python.org/downloads
  • Did you also try this on another platform? Does it work there? Same issue using conda
  • Tried the latest development version: Yes (with the same results)

A minimal example program which shows the error

import sys
from PySide6 import QtCore, QtWidgets, QtWebEngineWidgets

app = QtWidgets.QApplication()
q = QtWebEngineWidgets.QWebEngineView()
q.load(QtCore.QUrl('https://www.google.com/'))
q.show()
sys.exit(app.exec())

The frozen app is created by simply running: pyinstaller --clean -y qtwebengine.py

Stacktrace / full error message

There are no error messages. The frozen app exits after a few seconds.

@giumas giumas added the triage Please triage and relabel this issue label Dec 28, 2023
@rokm
Copy link
Member

rokm commented Dec 28, 2023

There are no error messages. The frozen app exits after a few seconds.

To clarify - it exits even if you run it from command prompt (so you can see its output even after it exits), or are you running it by double-clicking on the executable?

Because I cannot reproduce this - your example seems to work as expected if I freeze it either in Win 10 22H2 VM (no OpenGL) or on Win 10 22H2 notebook (OpenGL available). And we also have QtWebEngine tests in our test suite, so if something was fundamentally wrong with PySide6 and QtWebEngine, we would (hopefully) see that from the test failures.

@giumas
Copy link
Contributor Author

giumas commented Dec 31, 2023

To clarify - it exits even if you run it from command prompt (so you can see its output even after it exits), or are you running it by double-clicking on the executable?

The first one: "it exits even if you run it from command prompt (so you can see its output even after it exits)".

Because I cannot reproduce this - your example seems to work as expected if I freeze it either in Win 10 22H2 VM (no OpenGL) or on Win 10 22H2 notebook (OpenGL available).

I am also unable to reproduce using a VM. Furthermore, the same frozen app failing to run on my laptop actually works on a VM!

After some trials and attempts, I have identified the issue in having old drivers in my integrated Intel graphic card. Updating them fixed the issue.

The weirdness is that the unfrozen app works without issues on the same laptop. The laptop also has an NVIDIA graphic card.

At this point, my best guess is that the unfrozen app uses the NVIDIA card, but the frozen app the integrated graphic card. I have no idea of the reasons for such a behavior (and how to control it!).

@rokm
Copy link
Member

rokm commented Dec 31, 2023

At this point, my best guess is that the unfrozen app uses the NVIDIA card, but the frozen app the integrated graphic card. I have no idea of the reasons for such a behavior (and how to control it!).

You can verify this by setting QT_LOGGING_RULES environment variable to qt.webenginecontext.debug=true (either in the command prompt before running the program, or perhaps more practically, via os.environ['QT_LOGGING_RULES'] = 'qt.webenginecontext.debug=true' at the start of your program, before you do any PySide6 imports). This should dump additional information about WebEngineContext to the console - do the outputs differ between unfrozen and frozen program?

@giumas
Copy link
Contributor Author

giumas commented Dec 31, 2023

Just tested. The outputs do NOT differ between unfrozen and frozen program.

Additional information: before updating the drivers of the integrated graphics, I tested that setting the preferred graphics processor to "Integrated graphics" (in place of "Auto-select") in the NVIDIA Control Panel was making the unfrozen app to also exit without output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Please triage and relabel this issue
Projects
None yet
Development

No branches or pull requests

2 participants