[PyQt] pyQt5.7 and QtQuick

Arjen Hiemstra a.hiemstra at ultimaker.com
Mon Oct 17 10:03:21 BST 2016


On Saturday, 15 October 2016 12:35:05 CEST Louis Simons wrote:
> I built and installed PyQT and SIP from scratch on my installation, and now
> get a little farther.  I think my Ubuntu default version of SIP wasn't the
> latest which was causing weirdness.  I don't get a seg. fault, but I simply
> get a white screen with a bunch of errors like the following:
> 
> QOpenGLShaderProgram: could not create shader program
> QOpenGLShader: could not create shader
> QOpenGLShader: could not create shader
> shader compilation failed:
> ""
> QOpenGLShaderProgram::uniformLocation( matrix ): shader program is not
> linked
> QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not
> linked
> QOpenGLShaderProgram: could not create shader program
> QOpenGLShader: could not create shader
> QOpenGLShader: could not create shader
> ...
> Xlib:  extension "NV-GLX" missing on display ":0".
> 
> I think the last line is key.  I've updated my graphics drivers to the
> latest available for my graphics card (NVIDIA 340.98, had 340.96
> previously), and I'm pretty sure "NV-GLX" really isn't missing since I can
> still run the C++ version of the program.  PyQT QtWidgets still work fine.
> It seems to be either something unique to using OpenGL from Python or from
> PyQT.  Hoping that someone has seen something like this before and can
> point me in the right direction, or at least something new to try.

There is a known issue on Ubuntu when using PyQt OpenGL with NVidia binary 
drivers where it will load the Mesa GL libraries instead of the NVidia GL 
libraries and fail to compile shaders. See https://bugs.launchpad.net/ubuntu/
+source/python-qt4/+bug/941826 . The workaround is to use the following 
snippet before importing any OpenGL:

import ctypes
from ctypes.util import find_library
libGL = find_library("GL")
ctypes.CDLL(libGL, ctypes.RTLD_GLOBAL)

This will ensure the right libGL is loaded before the dynamic loading process 
kicks in.



More information about the PyQt mailing list