Spyder: Plot windows with qt4 or qt5 as backend for the IPython console run very slowly.

Created on 30 Jul 2020  路  13Comments  路  Source: spyder-ide/spyder

Issue Report Checklist

  • [ x] Searched the issues page for similar reports
  • [x ] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [x ] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [x ] Could not reproduce inside jupyter qtconsole (if console-related)
  • [x ] Tried basic troubleshooting (if a bug/error)

    • [x ] Restarted Spyder

    • [ x] Reset preferences with spyder --reset

    • [ x] Reinstalled the latest version of Anaconda

    • [x ] Tried the other applicable steps from the Troubleshooting Guide

  • [x ] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

When I use either qt4 or qt5 as the backend for the IPython console, the plot that opens up in a new window runs extremely slowly. This is different than other bug reports I have seen because the kernel itself works fine for me.

I think this has to do with version 5 of ipykernel, because I downgraded to ipykernel 4.10.0 (and downgraded to Spyder 3) and the plot window worked fine. Then I upgraded to ipykernel 5 (while still using Spyder 3) and the plot windows became slow again.

What steps reproduce the problem?

  1. Set qt4 or qt5 as the backend.
  2. Try to plot anything. For this I just plotted a sin curve:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 4*np.pi, num=1000)
y = np.sin(x)
plt.plot(x, y)

What is the expected output? What do you see instead?

I expect a window which will respond to the cursor position in real time -- instead it freezes up and takes several seconds to respond, even when exiting out.

Versions

  • Spyder version: 4.1.4
  • Python version: 3.7.7 64-bit
  • Qt version: 5.9.6
  • PyQt version: 5.9.2
  • Operating System name/version: Windows 10 64-bit

Dependencies

# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.5.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.16.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
paramiko >=2.4.0               :  2.7.1 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=1.0                   :  2.5.3 (OK)
pyls >=0.34.0;<1.0.0           :  0.34.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.2 (OK)
qtconsole >=4.6.0              :  4.7.5 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.1.2 (OK)
spyder_kernels >=1.9.2;<1.10.0 :  1.9.2 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.1 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  3.2.2 (OK)
numpy >=1.7                    :  1.18.5 (OK)
pandas >=0.13.1                :  1.0.5 (OK)
scipy >=0.17.0                 :  1.5.0 (OK)
sympy >=0.7.3                  :  1.6.1 (OK)

Awaiting Followup

Most helpful comment

@anaconda-pkg-build, could you package ipykernel 5.3.4? We have received bug reports about this problem in the last weeks, which was solved in that version. Thanks!

ipykernel 5.3.4 packages are now available in defaults

All 13 comments

After I updated yesterday, I had the same problem.
I can confirm that after downgrading ipykernel (5.3.3 -> 5.3.2) the plot window works as expected.

Workaround via downgrade to ipykernel 5.3.2 works on Anaconda Windows 10, with the following printed in the ipython terminal when running matplotlib.
QSocketNotifier: Multiple socket notifiers for same socket 1888 and type Read

Hi @lucasmyers97 @vinzk @duncanmcbryde thanks guys for pointing out the issue and a possible workaround. Checking a little bit seems like this is related with https://github.com/ipython/ipykernel/issues/528 and a release with the fix (ipykernel 5.3.4) was done a week ago. Could you guys try to update ipykernel to the latest release and check again? Thanks!

@dalthviz I have been using Anaconda as a package manager. When I try conda update ipykernel, it tries to update to ipykernel 5.3.3. Is there another way I am supposed to be updating it?

Totally right @lucasmyers97 I think ipykernel 5.3.4 is not yet available in the default conda channel. For now, I suggest to work with the version 5.3.2 (the work around found) and try again to update ipykernel when the package is uploaded (probably in a couple of days). Sorry for the inconvenience :/

Edit: ninja'd by @dalthviz with same finding.

@anaconda-pkg-build, could you package ipykernel 5.3.4? We have received bug reports about this problem in the last weeks, which was solved in that version. Thanks!

Same here: Running Spyder 4.1.4 on a completely new installation of Anaconda3-2020.07 on Windows 10 (new installation due to this problem ...). I can confirm that downgrading ipykernel to 5.3.2 solves the slowness problem. I would like to point out, however, that this workaround has the annoying property of throwing QSocketNotifier messages and that the number of these messages is incrementing every time I run a script (until I kill the IPython console).

Example code

import matplotlib.pyplot as pl
pl.figure()

Output of executing this twice:

Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.16.1 -- An enhanced Interactive Python.

runfile('C:/Users/schl/Desktop/ipykernelDemo.py', wdir='C:/Users/schl/Desktop')

QSocketNotifier: Multiple socket notifiers for same socket 2004 and type Read

runfile('C:/Users/schl/Desktop/ipykernelDemo.py', wdir='C:/Users/schl/Desktop')

QSocketNotifier: Multiple socket notifiers for same socket 2004 and type Read
QSocketNotifier: Multiple socket notifiers for same socket 2004 and type Read

@adrianschlatter mine does not do that. I assume this has something to do with Qt since QSocketNotifier is a class in Qt. I am running Qt version 5.9.6 and PyQt version 5.9.2. Which versions are you running? Might updating (or downgrading) those help?

@adrianschlatter, I fixed that problem in ipykernel 5.3.4.

@anaconda-pkg-build, could you package ipykernel 5.3.4? We have received bug reports about this problem in the last weeks, which was solved in that version. Thanks!

ipykernel 5.3.4 packages are now available in defaults

Thanks a lot for your help @jjhelmus!

Problem solved. Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings