geopython / geopython-workshop

The Doing Geospatial in Python Workshop (mainly provided at FOSS4G events)
https://geopython.github.io/geopython-workshop
Other
54 stars 21 forks source link

Ch. 7 - Visualization - Error in Jupyter Notebook when executing Cells #126

Closed justb4 closed 1 year ago

justb4 commented 1 year ago

Happens after upgrade to Jammy.

========== Ch 7 ===========
[I 11:38:11.111 NotebookApp] Saving file at /07-visualization.ipynb
[I 11:38:11.445 NotebookApp] Starting buffering for 755bdda5-d4ec-4dff-ad57-05d7e813439d:f3639f2fdd414a3e8dc71f37258c625e
[I 11:38:13.168 NotebookApp] 302 GET /notebooks/images/bokeh-example1.jpg (172.19.0.1) 3.370000ms
[I 11:38:14.065 NotebookApp] Discarding 40 buffered messages for 755bdda5-d4ec-4dff-ad57-05d7e813439d:f3639f2fdd414a3e8dc71f37258c625e
[E 11:38:14.514 NotebookApp] Uncaught exception in ZMQStream callback
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
      File "/usr/local/lib/python3.10/dist-packages/notebook/services/kernels/handlers.py", line 572, in _on_zmq_reply
        super()._on_zmq_reply(stream, msg)
      File "/usr/local/lib/python3.10/dist-packages/notebook/base/zmqhandlers.py", line 256, in _on_zmq_reply
        self.write_message(msg, binary=isinstance(msg, bytes))
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 334, in write_message
        return self.ws_connection.write_message(message, binary=binary)
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 1081, in write_message
        fut = self._write_frame(True, opcode, message, flags=flags)
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 1056, in _write_frame
        return self.stream.write(frame)
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 539, in write
        self._handle_write()
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 965, in _handle_write
        self._write_buffer.advance(num_bytes)
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 182, in advance
        assert 0 < size <= self._size
    AssertionError
[E 11:38:14.517 NotebookApp] Uncaught exception in zmqstream callback
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
        self._handle_recv()
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
        self._run_callback(callback, msg)
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
      File "/usr/local/lib/python3.10/dist-packages/notebook/services/kernels/handlers.py", line 572, in _on_zmq_reply
        super()._on_zmq_reply(stream, msg)
      File "/usr/local/lib/python3.10/dist-packages/notebook/base/zmqhandlers.py", line 256, in _on_zmq_reply
        self.write_message(msg, binary=isinstance(msg, bytes))
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 334, in write_message
        return self.ws_connection.write_message(message, binary=binary)
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 1081, in write_message
        fut = self._write_frame(True, opcode, message, flags=flags)
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 1056, in _write_frame
        return self.stream.write(frame)
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 539, in write
        self._handle_write()
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 965, in _handle_write
        self._write_buffer.advance(num_bytes)
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 182, in advance
        assert 0 < size <= self._size
    AssertionError
[E 11:38:14.519 NotebookApp] Exception in callback functools.partial(<function ZMQStream._update_handler.<locals>.<lambda> at 0x7fdf5a30e7a0>)
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/dist-packages/tornado/ioloop.py", line 738, in _run_callback
        ret = callback()
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 718, in <lambda>
        self.io_loop.add_callback(lambda: self._handle_events(self.socket, 0))
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 634, in _handle_events
        self._handle_recv()
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 663, in _handle_recv
        self._run_callback(callback, msg)
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 584, in _run_callback
        f = callback(*args, **kwargs)
      File "/usr/local/lib/python3.10/dist-packages/zmq/eventloop/zmqstream.py", line 308, in stream_callback
        return callback(self, msg)
      File "/usr/local/lib/python3.10/dist-packages/notebook/services/kernels/handlers.py", line 572, in _on_zmq_reply
        super()._on_zmq_reply(stream, msg)
      File "/usr/local/lib/python3.10/dist-packages/notebook/base/zmqhandlers.py", line 256, in _on_zmq_reply
        self.write_message(msg, binary=isinstance(msg, bytes))
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 334, in write_message
        return self.ws_connection.write_message(message, binary=binary)
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 1081, in write_message
        fut = self._write_frame(True, opcode, message, flags=flags)
      File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 1056, in _write_frame
        return self.stream.write(frame)
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 539, in write
        self._handle_write()
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 965, in _handle_write
        self._write_buffer.advance(num_bytes)
      File "/usr/local/lib/python3.10/dist-packages/tornado/iostream.py", line 182, in advance
        assert 0 < size <= self._size
    AssertionError

Happens first time with Strava map draw. No Bokeh plots are shown as well. Looks similar to this issue: https://youtrack.jetbrains.com/issue/DS-4883

justb4 commented 1 year ago

And similar to this: https://discourse.jupyter.org/t/jupyter-notebook-zmq-message-arrived-on-closed-channel-error/17869/27 Seems to occur when plotting, e.g. Matplotlib.

justb4 commented 1 year ago

Solved by updating the requirements.txt and the Dockerfile (all pip install moved to requirements.txt as well) as in issue #124.

tornado==6.2
jupyter-client==7.4.8
jupyter