gee-community/geemap

Uncaught exception in ZMQStream callback

fluidthinker opened this issue · 2 comments

Environment Information

Please run the following code on your computer and share the output with us so that we can better debug your issue:

Date: Sun Feb 26 06:32:28 2023 Central Standard Time

            OS : Windows
        CPU(s) : 12
       Machine : AMD64
  Architecture : 64bit
           RAM : 31.7 GiB
   Environment : Python

Python 3.10.9 | packaged by conda-forge | (main, Feb 2 2023, 20:14:58) [MSC
v.1929 64 bit (AMD64)]

        geemap : 0.20.0
            ee : 0.1.342
    ipyleaflet : 0.17.0
        folium : 0.12.1.post1
    jupyterlab : 3.6.1
      notebook : 6.5.2
     ipyevents : 2.0.1
     geopandas : 0.12.2

localtileserver : 0.6.4

Description

I downloaded the notebook for this exercise:
https://courses.geemap.org/gee_intro/Image/image_visualization/#rgb-composites
(2) The code for section RGB composites ran without errors
(3) I got exceptions when I executed Color Palettes section of the exercise. Specifically when I clicked on the layer button because by default the layer is hidden.

What I Did

Create a default map

Map = geemap.Map()

Load an image.

image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318')

Create an NDWI image, define visualization parameters and display.

ndwi = image.normalizedDifference(['B3', 'B5'])
ndwiViz = {'min': 0.5, 'max': 1, 'palette': ['00FFFF', '0000FF']}
Map.setCenter(-122.1899, 37.5010, 10) # San Francisco Bay
Map.addLayer(ndwi, ndwiViz, 'NDWI', False)

Display the map

Map
......

TRACEBACK

[W 06:27:55.097 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20230226062745 (::1) 8.980000ms referer=http://localhost:8888/notebooks/Image/image_visualization.ipynb
[E 06:28:29.254 NotebookApp] Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 308, in stream_callback
return callback(self, msg)
File "D:\CondaENV\geemap19\lib\site-packages\notebook\services\kernels\handlers.py", line 572, in _on_zmq_reply
super()._on_zmq_reply(stream, msg)
File "D:\CondaENV\geemap19\lib\site-packages\notebook\base\zmqhandlers.py", line 256, in _on_zmq_reply
self.write_message(msg, binary=isinstance(msg, bytes))
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 339, in write_message
return self.ws_connection.write_message(message, binary=binary)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 1086, in write_message
fut = self._write_frame(True, opcode, message, flags=flags)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 1061, in _write_frame
return self.stream.write(frame)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 546, in write
self._handle_write()
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 976, in _handle_write
self._write_buffer.advance(num_bytes)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 182, in advance
assert 0 < size <= self._size
AssertionError
[E 06:28:29.259 NotebookApp] Uncaught exception in zmqstream callback
Traceback (most recent call last):
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 621, in _handle_events
self._handle_recv()
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 650, in _handle_recv
self._run_callback(callback, msg)
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 308, in stream_callback
return callback(self, msg)
File "D:\CondaENV\geemap19\lib\site-packages\notebook\services\kernels\handlers.py", line 572, in _on_zmq_reply
super()._on_zmq_reply(stream, msg)
File "D:\CondaENV\geemap19\lib\site-packages\notebook\base\zmqhandlers.py", line 256, in _on_zmq_reply
self.write_message(msg, binary=isinstance(msg, bytes))
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 339, in write_message
return self.ws_connection.write_message(message, binary=binary)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 1086, in write_message
fut = self._write_frame(True, opcode, message, flags=flags)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 1061, in _write_frame
return self.stream.write(frame)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 546, in write
self._handle_write()
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 976, in _handle_write
self._write_buffer.advance(num_bytes)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 182, in advance
assert 0 < size <= self._size
AssertionError
[E 06:28:29.264 NotebookApp] Exception in callback functools.partial(<function ZMQStream._update_handler.. at 0x000001CC20904DC0>)
Traceback (most recent call last):
File "D:\CondaENV\geemap19\lib\site-packages\tornado\ioloop.py", line 740, in _run_callback
ret = callback()
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 705, in
self.io_loop.add_callback(lambda: self._handle_events(self.socket, 0))
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 621, in _handle_events
self._handle_recv()
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 650, in _handle_recv
self._run_callback(callback, msg)
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 584, in _run_callback
f = callback(*args, **kwargs)
File "D:\CondaENV\geemap19\lib\site-packages\zmq\eventloop\zmqstream.py", line 308, in stream_callback
return callback(self, msg)
File "D:\CondaENV\geemap19\lib\site-packages\notebook\services\kernels\handlers.py", line 572, in _on_zmq_reply
super()._on_zmq_reply(stream, msg)
File "D:\CondaENV\geemap19\lib\site-packages\notebook\base\zmqhandlers.py", line 256, in _on_zmq_reply
self.write_message(msg, binary=isinstance(msg, bytes))
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 339, in write_message
return self.ws_connection.write_message(message, binary=binary)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 1086, in write_message
fut = self._write_frame(True, opcode, message, flags=flags)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\websocket.py", line 1061, in _write_frame
return self.stream.write(frame)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 546, in write
self._handle_write()
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 976, in _handle_write
self._write_buffer.advance(num_bytes)
File "D:\CondaENV\geemap19\lib\site-packages\tornado\iostream.py", line 182, in advance
assert 0 < size <= self._size
AssertionError
[I 06:29:55.526 NotebookApp] Saving file at /Image/image_visualization.ipynb

It works fine on my end. The error message indicates this is an issue wit the tornado package rather than geemap. You can try creating a fresh conda env to install geemap or use Colab.

https://colab.research.google.com/github/giswqs/GEE-Courses/blob/master/docs/gee_intro/Image/image_visualization.ipynb

Thank you for your help. I created a fresh conda environment, reinstalled geemap. Still same error. I then switched from jupyter notebook to jupyter labs. Using jupter labs I no longer received the error messages. All works perfectly now! I'll try installing geemap on another machine.