Open RinaldoB opened 6 years ago
Probably related: https://github.com/conda-forge/pyqt-feedstock/issues/19
It is very unlikely to be related since that issue is very old and Qt 5.9 is very new.
What do you see from the command line if you run spyder? What OS are you running exactly?
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.86-1 x86_64 GNU/Linux
My understanding of the issue is that "PyQt5.QtWebEngineWidgets" is not available in the Anaconda distribution. Spyder then falls back to PyQt5.QtWebKitWidgets, which is also not available because it has been deprecated and removed from Qt 5.6.
Is this the intended behavior?
Traceback (most recent call last):
File "anaconda2/bin/spyder", line 11, in <module>
sys.exit(main())
File "anaconda2/lib/python2.7/site-packages/spyder/app/start.py", line 159, in main
from spyder.app import mainwindow
File "anaconda2/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 92, in <module>
from qtpy import QtWebEngineWidgets # analysis:ignore
File "anaconda2/lib/python2.7/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in <module>
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ImportError: No module named QtWebKitWidgets
My understanding of the issue is that "PyQt5.QtWebEngineWidgets" is not available in the Anaconda distribution. Spyder then falls back to PyQt5.QtWebKitWidgets, which is also not available because it has been deprecated and removed from Qt 5.6.
No, that issue is out of date. Since Qt 5.9
, PyQt5.QtWebEngineWidgets
is available on all OSes (but only with Python 3
on Windows, Python 2
on Windows is restricted to needing Qt 5.6
). Something else is going on here.
Can you show the output of LD_DEBUG=all spyder
please? It will be pretty long I am afraid.
Maybe this is in fact more useful
----> 1 import PyQt5.QtWebEngineWidgets
ImportError: libEGL.so.1: cannot open shared object file: No such file or directory
Did spyder
ever work on this machine? Are you really using Debian 7
/ wheezy
here?
Can you try installing libegl1-mesa
and/or libgl1-mesa-glx
and see if matters improve?
spyder has been working for years on this machine, until the last ´conda update --all´, as stated in the opening post
yes, the machine is in Debian 7
Ok did you try installing those packages?
great, PyQt5.QtWebEngineWidgets can be imported after instalation of the libegl1-mesa
packages. however spyder still fails to start with a Segmentation fault
during the start up screen
Thanks for the feedback. I setup a new Debian 7 VM and was able to run spyder
with no problem.
Can you install gdb
(using apt-get
, unfortunately we do not currently have conda packages for this) and then run gdb --args python -c "from spyder.app.start import main; main()"
, then enter r
, then, once it crashes enter bt
and paste the output here. Cheers!
Did you conda update --all
in the Debian 7 VM?
I tried a fresh Anaconda 5.1 installation, and spyder is starting fine. After conda update --all
i still get a segmentation fault:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007fffd3215f23 in QOpenGLContext::makeCurrent(QSurface*) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Gui.so.5
#2 0x00007ffff7e09656 in ?? () from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5QuickWidgets.so.5
#3 0x00007ffff7e0b50a in QQuickWidget::resizeEvent(QResizeEvent*) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5QuickWidgets.so.5
#4 0x00007fffc1763813 in ?? () from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5WebEngineWidgets.so.5
#5 0x00007fffcdfb42c6 in QWidget::event(QEvent*) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#6 0x00007ffff7e0bf47 in QQuickWidget::event(QEvent*) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5QuickWidgets.so.5
#7 0x00007fffc1763b0e in ?? () from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5WebEngineWidgets.so.5
#8 0x00007fffcdf897e0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#9 0x00007fffcdf8f6a5 in QApplication::notify(QObject*, QEvent*) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#10 0x00007fffce4b594e in sipQApplication::notify(QObject*, QEvent*) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/QtWidgets.so
#11 0x00007fffd6d8f85c in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Core.so.5
#12 0x00007fffcdfaeeae in QWidgetPrivate::sendPendingMoveAndResizeEvents(bool, bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#13 0x00007fffcdfb1ae2 in QWidgetPrivate::show_helper() ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#14 0x00007fffcdfb1a95 in QWidgetPrivate::showChildren(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#15 0x00007fffcdfb1afe in QWidgetPrivate::show_helper() ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#16 0x00007fffcdfb1a95 in QWidgetPrivate::showChildren(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#17 0x00007fffcdfb1afe in QWidgetPrivate::show_helper() ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#18 0x00007fffcdfb1a95 in QWidgetPrivate::showChildren(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#19 0x00007fffcdfb1afe in QWidgetPrivate::show_helper() ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#20 0x00007fffcdfb3bb5 in QWidget::setVisible(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#21 0x00007fffcdfb1a9f in QWidgetPrivate::showChildren(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#22 0x00007fffcdfb1afe in QWidgetPrivate::show_helper() ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#23 0x00007fffcdfb3bb5 in QWidget::setVisible(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#24 0x00007fffce6461d3 in sipQTabWidget::setVisible(bool) () from /Anaconda/lib/python2.7/site-packages/PyQt5/QtWidgets.so
#25 0x00007fffcdfb1a9f in QWidgetPrivate::showChildren(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#26 0x00007fffcdfb1afe in QWidgetPrivate::show_helper() ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#27 0x00007fffcdfb1a95 in QWidgetPrivate::showChildren(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#28 0x00007fffcdfb1afe in QWidgetPrivate::show_helper() ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#29 0x00007fffcdfb1a95 in QWidgetPrivate::showChildren(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#30 0x00007fffcdfb1afe in QWidgetPrivate::show_helper() ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#31 0x00007fffcdfb3bb5 in QWidget::setVisible(bool) ()
from /Anaconda/lib/python2.7/site-packages/PyQt5/../../../libQt5Widgets.so.5
#32 0x00007fffce5bd9f3 in sipQMainWindow::setVisible(bool) () from /Anaconda/lib/python2.7/site-packages/PyQt5/QtWidgets.so
#33 0x00007fffce693e62 in meth_QWidget_show () from /Anaconda/lib/python2.7/site-packages/PyQt5/QtWidgets.so
#34 0x00007ffff7ae2645 in PyEval_EvalFrameEx () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#35 0x00007ffff7ae4519 in PyEval_EvalCodeEx () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#36 0x00007ffff7ae14b2 in PyEval_EvalFrameEx () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#37 0x00007ffff7ae4519 in PyEval_EvalCodeEx () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#38 0x00007ffff7ae14b2 in PyEval_EvalFrameEx () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#39 0x00007ffff7ae2ddc in PyEval_EvalFrameEx () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#40 0x00007ffff7ae4519 in PyEval_EvalCodeEx () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#41 0x00007ffff7ae473a in PyEval_EvalCode () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#42 0x00007ffff7afd96d in run_mod () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#43 0x00007ffff7afe786 in PyRun_StringFlags () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#44 0x00007ffff7b0008e in PyRun_SimpleStringFlags () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#45 0x00007ffff7b11b72 in Py_Main () from /Anaconda/bin/../lib/libpython2.7.so.1.0
#46 0x00007ffff6decead in __libc_start_main (main=<optimized out>, argc=<optimized out>, ubp_av=<optimized out>, init=<optimized out>,
fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe888) at libc-start.c:244
#47 0x00005555555548bf in _start ()
I did update all, but I used Python 3 when I was testing this, I will get back to you after testing on Python 2.
I rolled back to Anaconda 5.1 - spyder is working fine. Updated spyder to 3.2.8, still working fine.
After qt update qt=5.9.5 pyqt=5.9.2 qtpy=1.3.1
things go wrong. spyder starts but the application window is solid black.
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:
I think that qt 5.9
/ PyQt5.QtWebEngineWidgets
is not working properly on this machine.
It sounds to me like your graphics drivers are not capable enough to run QtWebEngine, perhaps because your graphics hardware is too old?
Can you get details of both of those please?
There are a lot of useful comments here: https://github.com/spyder-ide/spyder/issues/3226
Please let me know if any of them work for you.
Graphic card: nvidia Quadro NVS 295
NVIDIA Driver Version: 304.131
If you can run LD_DEBUG=all spyder
and paste the results that would be helpful too.
Also please try running (paraphrased from from, which has more details):
ldconf -p | grep libGL.so
cd /etc/ld.so.conf.d
cp x86-linux-gnu_GL.conf i386-linux-gnu_GL.conf
sudo ldconfig
https://github.com/Ultimaker/Cura/pull/131#issuecomment-176088664
thanks! https://github.com/spyder-ide/spyder/issues/3226#issuecomment-316021155 fixed the issue for me. I would like to unterstand how the issue is related to installing libegl1-mesa, libgl1-mesa-glx
. My understanding is that the fix prevents linking the mesa drivers to the GL library. Are the mesa drivers necessary on my machine?
Do you still need the output of LD_DEBUG=all spyder
? I don't have root access on this machine. If you would like to do some further testing requiring root, please put it in one comment, and I will forward it to the admin.
Great. Thanks a lot.
Can I safely remove the mesa drivers (libegl1-mesa, libgl1-mesa-glx) now?
Yes, probably, but can you confirm that the problem exhibits in the exact same with them installed and with them removed? Because if you were willing I'd like for you to do some quick tests on your machine.
First of all, would it be possible to try installing and running (in a separate test
env so you do not risk any breakage to your base
env) qtcreator
and rstudio
from my rdonnelly
channel I'd appreciate it. This should hopefully be fairly quick and easy for you (modulus download time).
Also, depending on how those tests proceed (i.e. if they both run OK; they probably will not), if I made you some test executables would you be willing to try them out? (If you'd rather not then that's completely fine too, you've already been very helpful).
These tests will help me to identify where I need to make this fix. I would like to do it at as low level as I can in our Qt stack as then it will work for more things.
Pinging @ccordoba12 about perhaps replacing:
from OpenGL import GL
with:
import ctypes
ctypes.CDLL("libGL.so.1", mode=ctypes.RTLD_GLOBAL)
though I've seen other versions of this workaround that check for it being run on ubuntu
or debian
first.
Do you still need the output of LD_DEBUG=all spyder
You shouldn't need root access for this AFAIK? But no, I do not need to see this.
Pinging @ccordoba12 about perhaps replacing: from OpenGL import GL
with:
import ctypes ctypes.CDLL("libGL.so.1", mode=ctypes.RTLD_GLOBAL)
Yes, we'll do it in our next version. Thanks for pointing it out Ray!
However, this is a problem for all PyQt apps that use WebEngine on Linux, not just for Spyder.
No it's a very isolated problem for people using Debian or Ubuntu with broken Nvidia drivers who have also install Mesa drivers AFAICT.
I tested it on many many Linux distros here! Ok all without Nvidia hardware.
But I am asking @RinaldoB to help to figure out how low level I need to make this fix. You say "all PyQt apps that use WebEngine" but actually it's more likely "all Qt apps that use QtWebEngine, QtOpenGL, QtDeclarative (and maybe even QtWidgets)".
I will fix it at as a low-level as I have to.
it's more likely "all Qt apps that use QtWebEngine, QtOpenGL, QtDeclarative (and maybe even QtWidgets)".
I will fix it at as a low-level as I have to.
I thought it was a problem with WebEngine only, but thanks for trying to fix this in Anaconda itself.
@mingwandroid I think I may have hit the same issue. I am on Debian testing, however I don't have an nvidia card. The video card is listed by lspci
as Intel Corporation HD Graphics 620 (rev 02)
.
This is how I can trigger the issue:
conda install qt=5.9 pyqt=5.9 matplotlib=2
. This installs qt 5.9.5. Spyder segfaults.conda upgrade spyder
. Spyder still segfaults..../spyder/app/start.py
and replace from OpenGL import GL
as suggested above. Spyder now works.conda create -n test qtcreator rstudio -c rdonnelly
. This installs qt 5.9.4 in the test
environment. Rstudio and Qt Creator both start without any obvious problems.Let me know if there is anything else I can do to help. I am afraid this is too low level for me to debug myself.
Thanks @jitseniesen, that's very helpful. This changes the mystery in a subtle but important way. I'm glad I didn't go messing about deep inside Qt's C++ code to fix this which is what I was contemplating.
Let me know if there is anything else I can do to help
I have a quick query. You said:
Per your suggestion, I ran
conda create -n test qtcreator rstudio -c rdonnelly
. This installs qt 5.9.4 in the test environment. Rstudio and Qt Creator both start without any obvious problems.
It should've installed qt 5.9.5 in the test env since I don't have 5.9.4 in https://anaconda.org/rdonnelly/qt/files
.. 5.9.4 would've been there last week sometime, but not recently. Can you confirm the version number for me?
Also, can you try the example from: http://zetcode.com/gui/pyqt5/firstprograms/ and also the one from https://gist.github.com/gioditalia/03c9fd5d793aeccbe065fea45d842431 and see if they work for you?
@RinaldoB, if you have time, can you also try conda create -n test qtcreator rstudio -c rdonnelly
and verify that they work fine for you please?
It should've installed qt 5.9.5 in the test env since I don't have 5.9.4 in https://anaconda.org/rdonnelly/qt/files
.. 5.9.4 would've been there last week sometime, but not recently. Can you confirm the version number for me?
Yes, you're right. I ran conda create -n test qtcreator rstudio -c rdonnelly
again and looked closely at what it did. It installs qt 5.9.5-h7e424d6_0 from the default channel.
Also, can you try the example from: http://zetcode.com/gui/pyqt5/firstprograms/ [...]
They all work fine
and also the one from https://gist.github.com/gioditalia/03c9fd5d793aeccbe065fea45d842431 and see if they work for you?
That one does not work:
~$ python qwe.py
[5169:5169:0100/000000.065026:ERROR:broker_posix.cc(41)] Invalid node channel message
Segmentation fault
Same backtrace:
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff24f1f23 in QOpenGLContext::makeCurrent(QSurface*) ()
from /home/jitse/misc/anaconda/lib/python3.6/site-packages/PyQt5/../../../libQt5Gui.so.5
#2 0x00007ffff23e3656 in ?? ()
from /home/jitse/misc/anaconda/lib/python3.6/site-packages/PyQt5/../../.././libQt5QuickWidgets.so.5
#3 0x00007ffff23e550a in QQuickWidget::resizeEvent(QResizeEvent*) ()
from /home/jitse/misc/anaconda/lib/python3.6/site-packages/PyQt5/../../.././libQt5QuickWidgets.so.5
However, if I edit the file and put
import ctypes
ctypes.CDLL("libGL.so.1", mode=ctypes.RTLD_GLOBAL)
before from PyQt5 import QtWebEngineWidgets
, then it does work.
can you also try conda create -n test qtcreator rstudio -c rdonnelly and verify that they work fine for you please?
On a fresh miniconda installation and qt=5.9.5, qtcreator
and rstudio
are starting up fine on my machine.
and also the one from https://gist.github.com/gioditalia/03c9fd5d793aeccbe065fea45d842431 and see if they work for you?
This example did not work:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-rinaldo'
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
Could not link shader program:
""
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed:
""
QOpenGLShaderProgram::uniformLocation(matrix): shader program is not linked
QOpenGLShaderProgram::uniformLocation(opacity): shader program is not linked
However, if I edit the file and put
import ctypes ctypes.CDLL("libGL.so.1", mode=ctypes.RTLD_GLOBAL) before from PyQt5 import QtWebEngineWidgets, then it does work.
on my machine this also helped. the script showed a white, blank window. not sure if it is supposed to display more than that.
How the mesa drivers are related to this problem still puzzles me. Before installing libegl1-mesa
and libgl1-mesa-glx
I could not import PyQt5.QtWebEngineWidgets
:
----> 1 import PyQt5.QtWebEngineWidgets
ImportError: libEGL.so.1: cannot open shared object file: No such file or directory
But it seems now that the solution for the issue is to actually prevent to mesa driver from loading by importing libGL.so.1
?! I won't dig into it, as Im fine with the fix so far, but I am curious whether PyQt5.QtWebEngineWidgets
would work without mesa drivers on this machine (can't remove the drivers due to missing root)
The solution is quite simple, reinstall Qt in conda:
conda install -c anaconda qt
@Kevin1129, the right command is
conda install -f qt
python3 -m pip install --upgrade PyQtWebEngine
? Any reason this isn't a dependency of spyder?
Actual Behavior
After updating packages with
conda update --all
I cannot start spyder anymore. It tries to import from PyQt5.QtWebKitWidgets which is not available.Expected Behavior
Execution of spyder.
Steps to Reproduce
Anaconda or Miniconda version:
5.1
Operating System:
Linux
conda info
conda list --show-channel-urls