Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python spyder could not initialize GLX

Trying to setup a desktop station for image processing. I recently installed ubuntu 16.04 and went through the guide by Adrian to install python3, cv2, and virtual enviroments.

Instead of using cv2 3.1.0, I used cv2 3.2.0 but besides that, everything was the same.

after installing correctly and running the various tests, I confirmed that python3 was working and cv2 was linked to python.

As I am used to graphical interfaces, I decided to install spyder as it has a nice GUI system. I have done this before on 2 separate devices (a laptop and a raspberry pi 3). However, upon installing on this desktop computer I ran into a weird problem.

When ever I run spyder, It results in the error below

  Could not initialize GLX
  Aborted (core dumped)

I have been looking online for solutions but I cannot seem to find an answer to this problem

edit: I went searching for core dump files on ubuntu and I found a bunch of files all containing the same code 00000033.

like image 365
Hojo.Timberwolf Avatar asked Feb 17 '17 06:02

Hojo.Timberwolf


Video Answer


2 Answers

I am running Ubuntu on a Raspberry Pi and was having the same issue with Spyder.

My original issue looked like this when trying to run spyder:

qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
Could not initialize GLX
Aborted (core dumped)

I tried most everything on this thread and was finally able to get it to work by exporting the following variable under the user I was trying to run it as:

export QT_XCB_GL_INTEGRATION=none

This was found in a QuteBrowser github issue thread covering a similar problem: https://github.com/NixOS/nixpkgs/issues/66755#issuecomment-657305962

like image 189
Khoward Avatar answered Oct 10 '22 20:10

Khoward


First of all, for our understanding:

GLX (initialism for "OpenGL Extension to the X Window System") is an extension to the X Window System core protocol providing an interface between OpenGL and the X Window System as well as extensions to OpenGL itself. It enables programs wishing to use OpenGL to do so within a window provided by the X Window System. GLX distinguishes two "states": indirect state and direct state.

Any way, I had a similar problem with QT installation and solved it installing the following package: libgl1-mesa-dri

sudo apt-get install libgl1-mesa-dri

Another similar solution I found was:

sudo apt-get purge nvidia*
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.orig
sudo rm /etc/X11/xorg.conf

For 32-bit,

sudo apt-get install --reinstall xserver-xorg-core libgl1-mesa-glx:i386 libgl1-mesa-dri:i386

For 64-bit

sudo apt-get install --reinstall xserver-xorg-core libgl1-mesa-glx:amd64 libgl1-mesa-dri:amd64

sudo dpkg-reconfigure xserver-xorg

I hope it helps you.

like image 31
omotto Avatar answered Oct 10 '22 22:10

omotto