问题
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.
回答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.
回答2:
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
回答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!
来源:https://stackoverflow.com/questions/42291236/python-spyder-could-not-initialize-glx