nglviewer / nglview

Jupyter widget to interactively view molecular structures and trajectories

Home Page:http://nglviewer.org/nglview/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jupyter_client version regression

wangenau opened this issue · comments

Hello,

I have a small issue with nglview. What I basically want to do is to view a simple trajectory, e.g., with

import mdtraj
import nglview
traj = mdtraj.load('monovac_traj.pdb')
view = nglview.show_mdtraj(traj)
view

Here is an example trajectory file for you to test.
The view works fine, but if I run the trajectory the view freezes after some time and the terminal gives the exception

[E 17:02:53.968 NotebookApp] Uncaught exception in ZMQStream callback
    Traceback (most recent call last):
      File "/home/wangenau/.local/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
      File "/home/wangenau/.local/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
      File "/home/wangenau/.local/lib/python3.10/site-packages/notebook/services/kernels/handlers.py", line 572, in _on_zmq_reply
        super()._on_zmq_reply(stream, msg)
      File "/home/wangenau/.local/lib/python3.10/site-packages/notebook/base/zmqhandlers.py", line 256, in _on_zmq_reply
        self.write_message(msg, binary=isinstance(msg, bytes))
      File "/home/wangenau/.local/lib/python3.10/site-packages/tornado/websocket.py", line 334, in write_message
        return self.ws_connection.write_message(message, binary=binary)
      File "/home/wangenau/.local/lib/python3.10/site-packages/tornado/websocket.py", line 1081, in write_message
        fut = self._write_frame(True, opcode, message, flags=flags)
      File "/home/wangenau/.local/lib/python3.10/site-packages/tornado/websocket.py", line 1056, in _write_frame
        return self.stream.write(frame)
      File "/home/wangenau/.local/lib/python3.10/site-packages/tornado/iostream.py", line 539, in write
        self._handle_write()
      File "/home/wangenau/.local/lib/python3.10/site-packages/tornado/iostream.py", line 965, in _handle_write
        self._write_buffer.advance(num_bytes)
      File "/home/wangenau/.local/lib/python3.10/site-packages/tornado/iostream.py", line 182, in advance
        assert 0 < size <= self._size
    AssertionError

I am unsure if this is a problem with nglview or with notebook/tornado.
A workaround for me was to downgrade jupyter_client to version 7.4.9 and everything works fine again.
Maybe it would be good to pin the version of jupyter_client?

Thanks for your effort!

A workaround for me was to downgrade jupyter_client to version 7.4.9

thanks @wangenau for your report. Which was the original version?

Originally I had version 8.3.0 installed, but the problem also appears for me beginning with version 8.0.

thanks

I guess this issue can be closed if I see it right.
This was probably a version regression for notebook 6.5.4.
In 6.5.5 pyzmq got fixed to <25 and the issue disappears.
If one uses the latest notebook version 6 one can safely upgrade jupyter_client.