opengeos / leafmap

A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
https://leafmap.org
MIT License
3.07k stars 361 forks source link

Panel Leafmap: Error: Could not process update msg for model id #752

Open MarcSkovMadsen opened 3 weeks ago

MarcSkovMadsen commented 3 weeks ago

I'm trying to get leafmap working with Panel similarly to Solara-Leafmap.

A lot of features work. But when I click the tool icon nothing visible happens. But in the console the error below is logged.

Error: Could not process update msg for model id: d5ea3f69eff947928f88b58f36d3ceaa
    at ipywidgets_bokeh.js?v=562368b20a64be95651bb8246b7420f7fce55538dff999aefaa78662a14d0d39:8:1474147
    at async _._handleCommMsg (ipywidgets_bokeh.js?v=562368b20a64be95651bb8246b7420f7fce55538dff999aefaa78662a14d0d39:2:623644)
    at async _._handleMessage (ipywidgets_bokeh.js?v=562368b20a64be95651bb8246b7420f7fce55538dff999aefaa78662a14d0d39:2:625144)

image

import leafmap

import panel as pn

pn.extension("ipywidgets")

widget = leafmap.Map()

layout = pn.Column(
    widget,
).servable()

You can see how it should work here

image

I don't know if this issue is caused by ipywidgets_bokeh or by leafmap. Thus I have crossposted in ipywidgets_bokeh #106

Name: bokeh
Version: 3.4.1
Location: /home/jovyan/repos/private/panel/.venv/lib/python3.11/site-packages
Requires: contourpy, jinja2, numpy, packaging, pandas, pillow, pyyaml, tornado, xyzservices
Required-by: ipywidgets-bokeh, panel
---
Name: ipywidgets-bokeh
Version: 1.6.0
Location: /home/jovyan/repos/private/panel/.venv/lib/python3.11/site-packages
Requires: bokeh, ipykernel, ipywidgets
Required-by:
---
Name: leafmap
Version: 0.33.0
Location: /home/jovyan/repos/private/panel/.venv/lib/python3.11/site-packages
Requires: bqplot, colour, duckdb, folium, gdown, geojson, ipyevents, ipyfilechooser, ipyleaflet, ipywidgets, matplotlib, numpy, pandas, plotly, pyshp, pystac-client, python-box, scooby, whiteboxgui, xyzservices
Required-by:
---
Name: panel
Version: 1.5.0a3.post1.dev124+g5b59d248.d20240606
Location: /home/jovyan/repos/private/panel/.venv/lib/python3.11/site-packages
Editable project location: /home/jovyan/repos/private/panel
Requires: bleach, bokeh, linkify-it-py, markdown, markdown-it-py, mdit-py-plugins, packaging, pandas, param, pyviz-comms, requests, tqdm, typing-extensions
Required-by:
giswqs commented 3 weeks ago

This seems an issue with ipywidgets_bokeh. Can you try using ipywidgets_bokeh directly with Panel without leafmap? If it doesn't work either, then it is an ipywidgets_bokeh issue. Otherwise, it may be a leafmap issue.

giswqs commented 3 weeks ago

This does not seem to be issue unique to leafmap. I tried ipyleaflet, it does not work either.

import ipyleaflet

import panel as pn

pn.extension("ipywidgets")

widget = ipyleaflet.Map()

layout = pn.Column(
    widget,
).servable()

image