spyder: Spyder v3.0.0b3 gives QOpenGLShader errors during startup

First of all, thanks a lot for the fast fixes regarding the (Py)Qt5 problems. I really appreciate it.

What steps will reproduce the problem?

  1. Initiate spyder from the terminal
  2. Splashscreen counts the tasks and disappear
  3. A proper titlebar and a window is setup however inside is completely empty (black)

What is the expected output? What do you see instead? Instead of the window panes nothing appears and the terminal repeats the following

""
QOpenGLShaderProgram::uniformLocation( qt_Matrix ): shader program is not linked
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""

Versions and main components

  • Spyder Version: 3.0.0b3
  • Python Version: 3.5.1
  • Operating system: Linux Mint 17
  • PyQt5 : 5.6 (via PyQt5.QtCore.PYQT_VERSION_STR)
  • QT5 : 5.5.1 (via PyQt5.QtCore.QT_VERSION_STR)

I also have Python 3.4 installed and I’m not sure which one is picked up by Spyder but python3 maps to 3.4.

Dependencies

N/A

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 40 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I have same issue. Fedora 24, x86_64, Nvidia GTX 550 Ti with driver NVIDIA 367.44

Instructions by @ilayn doesn’t work for me. But I found another solution.

Adding

from OpenGL import GL

into site-packages/spyder/app/start.py solves problem. Now Spyder starts fine. But it creates +1 dependency - pyopengl.

just installing PyOpenGL worked for me

conda install pyopengl

I did @ilayn’s suggestion (selecting the mesa driver) but it didn’t quite work. Related to that: the same file can be edited manually, see https://github.com/Ultimaker/Cura/pull/131#issuecomment-176088664 - found it thanks to @ilayn’s launchpad link:

cd /etc/ld.so.conf.d I found many conf files, including i386-linux-gnu_GL.conf and x86_64-linux-gnu_GL.conf cat x86_64-linux-gnu_GL.conf /usr/lib/nvidia-340-updates /usr/lib32/nvidia-340-updates … but i386-linux-gnu_GL.conf is empty. So I just copied the contents in x86_64-linux-gnu_GL.conf to i386-linux-gnu_GL.conf sudo ldconfig Everything is OK now☺

(due to @ilayn’s suggestion, the i386-linux-gnu_GL.conf contained a reference to the mesa driver which I overwrote)

This worked! (and I don’t need to put the from OpenGL import GL in spyder’s start.py anymore)

Kernel: 4.13.0-38-generic OS: Ubuntu 17.10 64bit

For me adding: from OpenGL import GL in site-packages/spyder/app/start.py resulted in missing python module OpenGL.

Installed missing package: conda install PyOpenGL And spyder runs like a charm.

However, all worked before I installed QtCreator and for OpenGL libraries for OpenGL vidget. Basically spyder stopped working after:

apt-get install libgl1-mesa-dev libglu1-mesa-dev

Like above, conda install pyopengl worked for me on Ubuntu 16.04 from a clean conda py3.6 environment, no file editing necessary

I’m not sure I fully understand the issue, but couldn’t the correct library be loaded by using ctypes rather than relying on PyOpenGL (which uses ctypes under the hood too)?

Would something like this work maybe?

import ctypes
ctypes.cdll.LoadLibrary("libGL.so.1")

or maybe:

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

could someone who’s affected by this bug try to remove the from OpenGL import GL workaround and test this instead?

While the above mentioned version fixes sound better, someone without the immediate ability to upgrade/reinstall may be interested in the workaround I found at https://stackoverflow.com/questions/42291236/python-spyder-could-not-initialize-glx/64848919#64848919 :

With Spyder 4.2.1 (Qt 5.12.10) on Debian and accessing from Windows with PuTTY and Xming 6.9.0.31 for X11-forwarding, launching Spyder initially failed with the printouts X server does not support XInput 2 and Could not initialize GLX.

Setting the environment variable export QT_XCB_GL_INTEGRATION=none made spyder work (within the same console session).

@olusis thank you so much! conda install PyOpenGL #fixed similar issue

I also encounter this problem after using conda update --all I have tried

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

conda install pyopengl

none of them work for me.

Ubuntu 17.10 64, kernel 4.13, Anaconda 4.5.1, python 3.6, spyder 3.2.8, qt 5.9.5, nvidia 390.48, 1080ti

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

works for me as well.

@ccordoba12 @randyzwitch Ubuntu 16.04 from a clean conda py3.6 environment: conda install pyopengl no file editing necessary Thank you randyzwitch! (and above someone)

In my case the lines

# This import is needed to fix errors with OpenGL when installed using pip
# See issue 3332
try:
    from OpenGL import GL
except:
    pass

in the start.py file can be removed with no effect.

Awesome, thanks for testing! Someone at https://github.com/qutebrowser/qutebrowser/issues/2821#issuecomment-315817856 confirmed the same too. Looks like we have a simpe pure-Python workaround then 😉

As Peter Wurtz mentioned in the linked LaunchPad page, it is sad to see that this is still not fixed.

I have no idea why this is happening but I’ll write down what I did whether it is relevant or not (because I don’t know what has changed). First I basically added the Ubuntu graphics ppa

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update

Then I installed the newest NVIDIA driver (367.27 at the time of writing) via Driver Manager. Then I have unlinked the symbolic link in the following directory. You can first check the result of

ldconfig -p | grep libGL.so

to see whether it is indeed still linked to mesa drivers. Hence, I used the following

cd /usr/lib/x86_64-linux-gnu/
sudo unlink libGL.so

After this I’ve used the solution given in AskUbuntu.SE

>> update-alternatives --display i386-linux-gnu_gl_conf

i386-linux-gnu_gl_conf - manual mode
  link currently points to /usr/lib/nvidia-367/alt_ld.so.conf
/usr/lib/i386-linux-gnu/mesa/ld.so.conf - priority 500
  slave i386-linux-gnu_xorg_extra_modules: /usr/lib/i386-linux-gnu/xorg/x11-extra-modules
/usr/lib/nvidia-367-prime/alt_ld.so.conf - priority 8603
/usr/lib/nvidia-367/alt_ld.so.conf - priority 8604
Current 'best' version is '/usr/lib/nvidia-367/alt_ld.so.conf'.

and then using

sudo update-alternatives --config i386-linux-gnu_gl_conf

first selected Nvidia-367-prime in the list and then one more time selecting the mesa drivers. Now all works properly.

Obviously I don’t know which step (probably the very last one) made it working but for the more knowledgeable people this might give a clue.