widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.88k stars 137 forks source link

panel example gives AttributeError: 'DummyComm' object has no attribute 'kernel' #138

Open lalligagger opened 1 year ago

lalligagger commented 1 year ago

I was hoping to integrate solara into an existing Panel app. Using the example provided on Solara's "Self Hosted" docs gives the error above. Here's the full traceback:

2023-06-03 09:52:02,888 Error running application handler <bokeh.application.handlers.script.ScriptHandler object at 0x127a77990>: 'DummyComm' object has no attribute 'kernel'
File 'ipywidget.py', line 70, in _on_widget_constructed:
isinstance(widget.comm.kernel, PanelKernel))): Traceback (most recent call last):
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/bokeh/application/handlers/code_runner.py", line 231, in run
    exec(self._code, module.__dict__)
  File "/Users/lalligagger/py_dev/langEO/solara_in_panel.py", line 17, in <module>
    pn.panel(button_widget).servable()
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/viewable.py", line 391, in servable
    self.server_doc(title=title, location=location) # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/viewable.py", line 1023, in server_doc
    model = self.get_root(doc)
            ^^^^^^^^^^^^^^^^^^
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/pane/base.py", line 418, in get_root
    root_view, root = self._get_root_model(doc, comm, preprocess)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/pane/base.py", line 343, in _get_root_model
    root = self.layout._get_model(doc, comm=comm)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/layout/base.py", line 170, in _get_model
    objects, _ = self._get_objects(model, [], doc, root, comm)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/layout/base.py", line 155, in _get_objects
    child = pane._get_model(doc, root, model, comm)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/pane/ipywidget.py", line 72, in _get_model
    model = self._get_ipywidget(self.object, doc, root, comm, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/pane/ipywidget.py", line 60, in _get_ipywidget
    _on_widget_constructed(w, doc)
  File "/Users/lalligagger/miniconda3/envs/langchain/lib/python3.11/site-packages/panel/io/ipywidget.py", line 70, in _on_widget_constructed
    isinstance(widget.comm.kernel, PanelKernel))):
               ^^^^^^^^^^^^^^^^^^
AttributeError: 'DummyComm' object has no attribute 'kernel'

Using panel 1.0.4 and bokeh 3.1.1

maartenbreddels commented 1 year ago

That worked before, so we probably introduced a bug. Can I ask why you want to have it running in a panel server?

lalligagger commented 1 year ago

Panel has been making plenty of updates to, just FYI. I have a control UI in panel but had issues with leaflet/ leafmap, so considered integrating.

This is less of an issue now, and I'm sure I'd use Solara at some point soon regardless of near-term panel compatibility.

On Wed, Jun 14, 2023, 12:57 PM Maarten Breddels @.***> wrote:

That worked before, so we probably introduced a bug. Can I ask why you want to have it running in a panel server?

— Reply to this email directly, view it on GitHub https://github.com/widgetti/solara/issues/138#issuecomment-1591888554, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZIQK4YPLY456WZXYW3GMTXLIJQ5ANCNFSM6AAAAAAYZMQIIQ . You are receiving this because you authored the thread.Message ID: @.***>