[PyQt] Workaround / fix for "could not create shader" issue with QtQuick on linux (causes all QtQuick examples to fail)

Phil Thompson phil at riverbankcomputing.com
Mon Jan 27 22:51:20 GMT 2014


On 27-01-2014 10:17 pm, Russell Warren wrote:
> I had a hard time tracking this down and the solution is somewhat 
> hard
> to find.  Im sending this to get it out there a bit better and
> increase the odds of other people finding it.
>
> In short, the solution is: `pip install PyOpenGL` and then put `from
> OpenGL import GL` at the top of any files you are having issues with.
>
> Many thanks to Peter Wuertz for this fix!!  See: these links:
>
> 
> http://thread.gmane.org/gmane.linux.ubuntu.bugs.general/3985762/focus=25964
> [1]
> https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826 [2]
>
> This is how the problem and solution look on my machine
> (using pyqt/examples/quick/animation as my example):
>
> $ python animation.py 
> QOpenGLShaderProgram: could not create shader program 
> QOpenGLShader: could not create shader 
> Renderer failed shader compilation: 
> "" 
> Segmentation fault
> $ pip install PyOpenGL
>  Requirement already satisfied (use --upgrade to upgrade): PyOpenGL 
> in
> /home/russ/.virtualenvs/edms/lib/python2.7/site-packages
> Cleaning up...
> $ #add the OpenGL import at the top of the file (demonstration hack!)
> $ sed -i 1ifrom OpenGL import GLn animation.py
> $ python animation.py  #This now works perfectly!  Woohoo!
> Segmentation fault
>
> The segfault remains when you close the app, but at least QtQuick now
> works!!  Im not sure about the segfault yet, but am assuming its
> along the lines of this:
> 
> http://python-camelot.s3.amazonaws.com/gpl/release/pyqt/doc/advanced/development.html
> [3]
>
> I saw some references indicating this could be due to old OpenGL
> drivers.  In my case it is not.  For good measure:
>
> $ glxinfo | grep "OpenGL version"
>
> OpenGL version string: 3.3.0 NVIDIA 304.88
>
> Also worth noting/confirming is that with my setup I had no issues
> getting QtQuick it working in C++.  Only PyQt5 had problems.

I assume there is a way to see which shared libraries are loaded by a 
running process. Can somebody compare the two cases?

Phil


More information about the PyQt mailing list