Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError on matplotlib interactive mode #952

Open
hs-vc opened this issue Jun 8, 2023 · 2 comments
Open

AssertionError on matplotlib interactive mode #952

hs-vc opened this issue Jun 8, 2023 · 2 comments

Comments

@hs-vc
Copy link

hs-vc commented Jun 8, 2023

When attempting to zoom into any area of a plot created using the matplotlib library in Jupyter Notebook with interactive mode enabled, an Assertion Error message is generated in the ~/.jupyter/log. Consequently, the zoom functionality does not work correctly.

Following is reproducible jupyter notebook code.

import matplotlib.pyplot as plt

%matplotlib nbagg

fig, ax = plt.subplots()
ax.plot([1,2,3], [1,2,3])

# And then zoom any areay

Below is error message in ~/.jupyter/log created every time zooming any area in the plot.

[E 04:10:45.852 NotebookApp] Uncaught exception in zmqstream callback
    Traceback (most recent call last):
      File "/opt/python/py3.10/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
        self._handle_recv()
      File "/opt/python/py3.10/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
        self._run_callback(callback, msg)
      File "/opt/python/py3.10/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
      File "/opt/python/py3.10/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
      File "/opt/python/py3.10/lib/python3.10/site-packages/notebook/services/kernels/handlers.py", line 572, in _on_zmq_reply
        super()._on_zmq_reply(stream, msg)
      File "/opt/python/py3.10/lib/python3.10/site-packages/notebook/base/zmqhandlers.py", line 256, in _on_zmq_reply
        self.write_message(msg, binary=isinstance(msg, bytes))
      File "/opt/python/py3.10/lib/python3.10/site-packages/tornado/websocket.py", line 339, in write_message
        return self.ws_connection.write_message(message, binary=binary)
      File "/opt/python/py3.10/lib/python3.10/site-packages/tornado/websocket.py", line 1086, in write_message
        fut = self._write_frame(True, opcode, message, flags=flags)
      File "/opt/python/py3.10/lib/python3.10/site-packages/tornado/websocket.py", line 1061, in _write_frame
        return self.stream.write(frame)
      File "/opt/python/py3.10/lib/python3.10/site-packages/tornado/iostream.py", line 546, in write
        self._handle_write()
      File "/opt/python/py3.10/lib/python3.10/site-packages/tornado/iostream.py", line 976, in _handle_write
        self._write_buffer.advance(num_bytes)
      File "/opt/python/py3.10/lib/python3.10/site-packages/tornado/iostream.py", line 182, in advance
        assert 0 < size <= self._size
    AssertionError

I tested with
Python: 3.10.10
notebook: 6.5.4
matplotlib: 3.7.1
tornado: 6.2
pyzmq: 25.0.2
jupyter_client: 8.2.0

I seems that this issue is specifically related to jupyter_client v8.2.0. The error does not occur with jupyter_client versions 7.x while other versions remain unchanged.

@ccordoba12
Copy link
Contributor

By interactive you mean the Notebook backend or the Qt, Tk, etc ones?

@hs-vc
Copy link
Author

hs-vc commented Jun 12, 2023

By interactive you mean the Notebook backend or the Qt, Tk, etc ones?

I mean notebook backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants