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

PyQt5, QWebEngine and Opengl context #1930

Closed
Insoleet opened this Issue Apr 8, 2016 · 7 comments

Comments

Projects
None yet
6 participants
@Insoleet
Contributor

Insoleet commented Apr 8, 2016

Hello,

My application was running fine before I add a QWebEngineView to it. Running the application using python works fine, but the .exe generated by pyinstaller dont.

I have the following errors when I start my application :

 ./sakia 
PyInstaller Bootloader 3.x
LOADER: executable is /home/inso/code/sakia/dist/sakia/sakia
LOADER: homepath is /home/inso/code/sakia/dist/sakia
LOADER: _MEIPASS2 is NULL
LOADER: archivename is /home/inso/code/sakia/dist/sakia/sakia
LOADER: Extracting binaries
LOADER: Executing self as child
LOADER: set _MEIPASS2 to /home/inso/code/sakia/dist/sakia
LOADER: LD_LIBRARY_PATH=/home/inso/code/sakia/dist/sakia
PyInstaller Bootloader 3.x
LOADER: executable is /home/inso/code/sakia/dist/sakia/sakia
LOADER: homepath is /home/inso/code/sakia/dist/sakia
LOADER: _MEIPASS2 is /home/inso/code/sakia/dist/sakia
LOADER: archivename is /home/inso/code/sakia/dist/sakia/sakia
LOADER: Already in the child - running user's code.
LOADER: Python library: /home/inso/code/sakia/dist/sakia/libpython3.5m.so.1.0
LOADER: Loaded functions from Python library.
LOADER: Manipulating environment (sys.path, sys.prefix)
LOADER: Pre-init sys.path is /home/inso/code/sakia/dist/sakia/base_library.zip:/home/inso/code/sakia/dist/sakia
LOADER: sys.prefix is /home/inso/code/sakia/dist/sakia
LOADER: Setting runtime options
LOADER: Initializing python
LOADER: Overriding Python's sys.path
LOADER: Post-init sys.path is /home/inso/code/sakia/dist/sakia/base_library.zip:/home/inso/code/sakia/dist/sakia
LOADER: Setting sys.argv
LOADER: setting sys._MEIPASS
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: callfunction returned...
LOADER: extracted pyimod01_os_path
LOADER: callfunction returned...
LOADER: extracted pyimod02_archive
LOADER: callfunction returned...
LOADER: extracted pyimod03_importers
LOADER: callfunction returned...
LOADER: Installing PYZ archive with Python modules.
LOADER: PYZ archive: out00-PYZ.pyz
LOADER: Running pyiboot01_bootstrap.py
LOADER: Running pyi_rth_qt5.py
LOADER: Running pyi_rth_qt5plugins.py
LOADER: Running pyi_rth_pkgres.py
LOADER: Running pyi_rth_qt5webengine.py
LOADER: Running main.py
static QPlatformTheme* QKdeTheme::createKdeTheme(): Unable to determine KDE dirs
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled

The application does not crash. But when I make my QWebEngineView I get a transparent windows which cannot display anything. Here are the logs :

Qt WebEngine Plugins directory not found. Trying fallback directory... Plugins as for example video codecs MAY NOT work.
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
[1]    20181 segmentation fault (core dumped)  ./sakia

Here is a sample code which reproduces the error :

import sys
import os

from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QUrl

if __name__ == '__main__':
    app = QApplication(sys.argv)

    view = QWebEngineView()
    view.resize(1024, 600)
    view.load(QUrl("http://eric-ide.python-projects.org"))
    view.show()

    sys.exit(app.exec_())

Also, adding the missing plugins to the build dir does not fix the bug.

@YuncyYe

This comment has been minimized.

YuncyYe commented Apr 19, 2016

Please make sure your pyqt has the following directories:
plugins
resources
translations

If it doesn't have these directories, you can copy these from the raw qt release(after installation).

@htgoebel

This comment has been minimized.

Member

htgoebel commented Apr 24, 2016

This looks like not all required files are packages. Please have a look at Make sure everything is packaged correctly for tips to find out what is missing.

@htgoebel htgoebel added the need info label Apr 24, 2016

@Insoleet

This comment has been minimized.

Contributor

Insoleet commented Apr 24, 2016

Please make sure your pyqt has the following directories:
plugins
resources
translations

In which path ? In site-packages ?

@songsb13

This comment has been minimized.

songsb13 commented May 3, 2017

I have the same problem

I am using PyQt5.8, python3.5, Pyinstaller 3.3.dev0+964547c.

I have all files and directory

plugins
resources
translations

in both PyQt5, Qt5 and even found them in the temp folder.

I reinstalled Pyinstaller, PyQt5, and Qt5.

It runs perfectly with python, but when it is compiled with Pyinstaller.

The WebEngine shows a blank window.

I used the same code.

Any Solution?

@smearumi

This comment has been minimized.

smearumi commented May 10, 2017

I'm using Fedora 24 and I've solved the problem as follows:

After finishing the execution of pyinstaller:

  1. Remove everything inside the directory <package_directory>/qt5_plugins/
  2. Copy everything from /usr/lib64/python3.5/site-packages/PyQt5/Qt/plugins/ and Paste to <package_directory>/qt5_plugins/
  3. Create directories <package_directory>/PyQt5/Qt
  4. Copy 'libexec', 'resources', 'translations' directories from /usr/lib64/python3.5/site-packages/PyQt5/Qt/ and Paste to <package_directory>/PyQt5/Qt/

These steps should solve this issue.

@htgoebel

This comment has been minimized.

Member

htgoebel commented Dec 2, 2017

Is this still an issue? If so, please try the latest development version of PyInstaller.

@bjones1

This comment has been minimized.

Member

bjones1 commented Jan 31, 2018

I'm closing this, since #3233 should fix it -- see the instructions there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment