[PyQt] Ubuntu, PyQt/Qt 5.9, QOpenGLShaderProgram "is not linked"

Florian Bruhin me at the-compiler.org
Mon Jul 17 15:54:05 BST 2017

On Mon, Jul 17, 2017 at 07:36:24AM -0700, David Cortesi wrote:
> Thanks to all who replied with useful references!
> The key point seems to be (from
> https://github.com/spyder-ide/spyder/issues/3226):
> > PyQt opens libGL.so, which on some systems is a link to the MESA GL
> library, not the NVIDIA GL library. The NVIDIA drivers *should* have
> changed that link to point to the NVIDIA library when they were installed,
> but didn't. As a result, PyQt is loading the wrong GL library.
> See also the comment by Peter W├╝rtz on the four year old (!!) Ubuntu issue
> here,
> https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826/comments/25

Hmm, wait - if PyOpenGL only is needed so the correct library is loaded,
couldn't we just do the same using ctypes? I unfortunately don't have a
machine to test this, but can you try if this helps?

    import ctypes

or maybe this:

    ctypes.CDLL("libGL.so.1", mode=ctypes.RTLD_GLOBAL)

> I will experiment with symlinking libGL.so to libGL.so.1 to see if that
> makes a difference in my particular system. I will also try the workaround
> of importing GL only under Linux. However I mean to bundle the app with
> PyInstaller, and it will see that import and include the dependency on
> every platform anyway -- unless I maintain a special Linux version with
> that import.

FWIW you can just ignore an ImportError, and change your .spec file to
add OpenGL to PyInstaller's excludes on non-Linux systems.


https://www.qutebrowser.org  | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170717/89082aed/attachment.sig>

More information about the PyQt mailing list