spyder: ZMQError when running code in the console

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

This is not really a problem so far since all is working as expected, but since this showed up on multiple PCs where I did a fresh miniconda / spyder install, I thought I’ll ask whats going on here…

What steps reproduce the problem?

  1. install fresh miniconda
  2. conda install -c conda-forge spyder
  3. start spyder

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

I’d expect spyder to start without any issues/warnings… however, when I start spyder, the following shows up:

fromIccProfile: failed minimal tag size sanity
...\envs\rt1\lib\site-packages\jupyter_client\threaded.py:73: RuntimeWarning: ZMQStream only supports the base zmq.Socket class.

                Use zmq.Socket(shadow=other_socket)
                or `ctx.socket(zmq.DEALER, socket_class=zmq.Socket)`
                to create a base zmq.Socket object,
                no matter what other kind of socket your Context creates.

  self.stream = zmqstream.ZMQStream(self.socket, self.ioloop)

Versions

  • Spyder version: 5.4.1
  • Python version: 3.9.15
  • Qt version: 5.15.6
  • PyQt version: 5.15.7
  • Operating System name/version: Windows 10

Dependencies

[click to show dependency list... ALL OK !]
# Mandatory:
atomicwrites >=1.2.0          :  1.4.1 (OK)
chardet >=2.0.0               :  5.1.0 (OK)
cloudpickle >=0.5.0           :  2.2.0 (OK)
cookiecutter >=1.6.0          :  2.1.1 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.0.2 (OK)
IPython >=7.31.1;<9.0.0       :  8.8.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.2 (OK)
jellyfish >=0.7               :  0.9.0 (OK)
jsonschema >=3.2.0            :  4.17.3 (OK)
keyring >=17.0.0              :  23.13.1 (OK)
nbconvert >=4.0               :  7.2.7 (OK)
numpydoc >=0.6.0              :  1.5.0 (OK)
paramiko >=2.4.0              :  2.12.0 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.9.4 (OK)
pygments >=2.0                :  2.14.0 (OK)
pylint >=2.5.0;<3.0           :  2.15.10 (OK)
pylint_venv >=2.1.1           :  2.3.0 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.7.0;<1.8.0          :  1.7.0 (OK)
pylsp_black >=1.2.0           :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0     :  3.0.3 (OK)
qstylizer >=0.2.2             :  0.2.2 (OK)
qtawesome >=1.2.1             :  1.2.2 (OK)
qtconsole >=5.4.0;<5.5.0      :  5.4.0 (OK)
qtpy >=2.1.0                  :  2.3.0 (OK)
rtree >=0.9.7                 :  1.0.1 (OK)
setuptools >=49.6.0           :  65.6.3 (OK)
sphinx >=0.6.6                :  6.1.3 (OK)
spyder_kernels >=2.4.1;<2.5.0 :  2.4.1 (OK)
textdistance >=4.2.0          :  4.5.0 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.2.1 (OK)
zmq >=22.1.0                  :  25.0.0 (OK)

# Optional:
cython >=0.21                 :  0.29.33 (OK)
matplotlib >=3.0.0            :  3.6.2 (OK)
numpy >=1.7                   :  1.24.1 (OK)
pandas >=1.1.1                :  1.5.2 (OK)
scipy >=0.17.0                :  1.10.0 (OK)
sympy >=0.7.3                 :  None (OK)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 33 (20 by maintainers)

Most upvoted comments

Hey @dalthviz Thanks for the response!

First, I tried completions in a jupyter qtconsole (with IPython 8.9.0) and everything works fine there.
(e.g. completions show up as expected)

Then I downgraded to IPython 7.33.0, and you were right! Now completions show up in the spyder console as expected again!

Finally I re-installed pyzmq 25.0 to see if the initial issues persist when using IPython 7.33.0. Unfortunately the pyzmq warnings remain so I the 2 issues (autocompleting and the pyzmq warnings/errors) I’m facing might not be related. (also this pyqt error shows up now at startup: QTextCursor::setPosition: Position '-1' out of range)


To sumarize:

  • using spyder 5.4.3 with pyzmq 24.0.1 and IPython 7.33.0 all works as expected
    • using IPython 8.9.0 causes autocompletion in the console to fail (beyond the first level of attributes)
    • using pyzmq 25.0 results in the initial warnings as described above and randomly occurring errors like an unresponsive console and matplotlib qt popup plots that remain open even after the console is closed/restarted

To be more precise: Somehow it is no longer possible to autocomplete beyond base-classes and functions… Here’s an example trying to autocomplete attributes of np.ndarray

@raphaelquast, this should be fixed in IPython 8.13 thanks to the PR I opened for it: https://github.com/ipython/ipython/pull/14029.

sorry to revert back on my previous comment… but unfortunately pyzmq 25.0.2 alone does not solve the issue! It just took a while until it showed up again…

That shows that we also require the Jupyter-client fix @minrk did in its version 8.1.0 release to fully solve this problem. So, I added support for it to Spyder-kernels, which will be part of its 2.4.3 version.

However, in the process I also tested upgrading to IPython 8.11.0 in the hope that it fixes autocompletion Is there an issue addressing this behavior? (https://github.com/spyder-ide/spyder/issues/20393 seems to be a different problem)

That’s not a bug in Spyder. It’s actually a bug in IPython, so I’ll report it there. A workaround for now is to go to

Tools > Preferences > IPython console > Advanced settings

and enable the option called

Use Jedi completion in the IPython console

However, you need to be aware that that could make the console slower when inspecting big dataframes or other large variables. That’s why it’s disabled by default.

You should be able to test just pyzmq 25.0.2, which I think will be sufficient.

@ccordoba12 OK, thanks for the clarification! Feel free to ping me if you want someone to check if this issue persists on windows once Spyder 5.4.3 is released!

@raphaelquast if you upgrade to jupyter-client 8.1.0 and/or pyzmq 25.0.2, that should test whether the fixes are working.

Never feel bad about pinging me on pyzmq issues! I’ll look into it now.

@ccordoba12 thanks for the response!

I know that the initial message is a warning but the internal errors I’m encountering also cause the console to become irresponsive (including quite strange behaviors such as the fact that matplotlib qt popup-plots remain open even if the parent spyder console is closed…).

I’ll do a completely fresh setup as soon as possible and report back if the issues persist! (so far I haven’t been able to find a reproducible set of steps that cause the issue… it just happens after a certain amount of time without any obvious reason)