Python spyder could not initialize GLX

11,133

Solution 1

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.

Solution 2

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

Solution 3

I had the same issue, using x2go. After trying everything mentioned above, the only solution I found was to launch spyder in a different way. Before this, I would so as follows (and it worked perfectly for spyder 4):

source activate [name of your virtual environment]
spyder&

Since last week, the 'spyder&' command no longer launches the IDE, and I managed to surpass this by writing instead:

source activate [name of your virtual environment]
spyder3

The terminal still complains about certain issues, but at least I can work now!

Solution 4

I had this problem, spyder was not starting when using a ssh connection and I had the error : Could not initialize GLX. This was because the qt version was to recent : 5.9

I could not solve it by installing pyopengl, nor any other fixes that I found on the web. Simply installing qt 5.6.2 (with conda -c conda-forge) did not work either because it downgraded my version of matplotlib to 2.2

I got it working by reinstalling a full conda environment to make sure I have the matplotlib version that I wanted : 3.1.1

Solution : conda install -c conda-forge matplotlib=3.1 qt=5.6.2 spyder

Share:
11,133
Hojo.Timberwolf
Author by

Hojo.Timberwolf

Research Scientist with no formal programming training. All self taught.

Updated on June 23, 2022

Comments

  • Hojo.Timberwolf
    Hojo.Timberwolf almost 2 years

    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.

  • Hojo.Timberwolf
    Hojo.Timberwolf about 7 years
    Thanks, that fixed the problem. Once I reinstalled, it started working. Though a new error arose which was a segmentation error. After looking, this appears to be a memory error so I am going to preform a fresh install and try again.
  • omotto
    omotto about 7 years
    Thanks for your comment, I will leave the answer if it can be useful for other users.
  • Joana Rocha
    Joana Rocha about 4 years
    If you have any issue, spyder --reset after activating the environment may also help. After that, try either spyder or spyder3 again.
  • user3731622
    user3731622 over 3 years
    After activating environment, even spyder --reset gives me failed to get the current screen resources Could not initialize GLX Aborted (core dumped)
  • Joana Rocha
    Joana Rocha over 3 years
    Not sure it will work, but try to reset it before activating the environment. This is a really tricky issue. I tried a bunch of different ways before it worked for me... The only thing that worked was my suggestion above.
  • Joana Rocha
    Joana Rocha over 3 years
    If that does not work, my suggestion is to create a new environment and reset spyder in that one. Let me know if it works.
  • user3731622
    user3731622 over 3 years
    Thanks Joana. Eventually what worked was creating a new conda environment. However this only worked when I specified specific versions of qt and I think spdyer. Otherwise conda would suggest installing versions which gave me issues. This was troubling b/c I wanted to use spyder with relatively new version of tensorflow. Thus getting the right mix of old qt, spyder to work with new tensorflow was a struggle.
  • Ashwin Kumar k
    Ashwin Kumar k over 2 years
    I had the same error in running eagle cad - 9.6.2 on manjaro kde Linux and the export worked well.