pythonipythonipdb

ipython debugger is flooded with Qt errors after pylab import


I can't use the debugger in ipython after importing anything pyqt related.

If I don't import anything and debug an error post-mortem like

$ ipython3

In [1]: abc
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-03cfd743661f> in <module>
----> 1 abc

NameError: name 'abc' is not defined

In [2]: %debug
> <ipython-input-1-03cfd743661f>(1)<module>()
----> 1 abc

ipdb> 

all is well, but if I start ipython3 with the pyqt5 backend I get

$ ipython3 --pylab=qt5

In [1]: abc
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-03cfd743661f> in <module>
----> 1 abc

NameError: name 'abc' is not defined

In [2]: %debug
> <ipython-input-1-03cfd743661f>(1)<module>()
----> 1 abc

ipdb> QObject: Cannot create children for a parent that is in a different thread.
(Parent is QApplication(0x2105860), parent's thread is QThread(0x1ccc6c0), current thread is QThread(0x7fe7940021f0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QApplication(0x2105860), parent's thread is QThread(0x1ccc6c0), current thread is QThread(0x7fe7940021f0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QApplication(0x2105860), parent's thread is QThread(0x1ccc6c0), current thread is QThread(0x7fe7940021f0)
QObject: Cannot create children for a parent that is in a different thread.
[...]

I am not developing with qt, I only use it as the backend for matplotlib. I know that this question is very vague, but I don't know where to look for a solution.

I'm on Ubuntu 18.04, Python 3.6.9, ipython 7.14.0, pyqt5 5.14.2.


Solution

  • The problem is resolved with upgrading the pip package "prompt_toolkit" via

    $ pip3 install --upgrade prompt_toolkit  # optionally --user 
    

    For me it went from version 2.0.10 to 3.0.5.