Search code examples
pythonraspberry-pipyqt5python-3.8qtwebengine

QApplication breaks when importing QWebEnginePage on RasPi 4B


My code:

from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEnginePage

print("this code is reached")
app = QApplication(["foo"])
print("this code is not reached")

results in the error:

this code is reached
qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
Could not initialize GLX

However, if I don't import QWebEnginePage (just uncomment line 3), the code works.

My system: Ubuntu 20.04, RaspberryPi 4B


Solution

  • export QT_XCB_GL_INTEGRATION=none solves the problem. However I am wondering whether it could be solved without disabling OpenGL. Answer coming from this thread mentioned by Teejay Bruno.