-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change request for BokehModel initialization: call to standalone_docs_json_and_render_items error #176
Comments
@flanabode Please provide all relevant version information |
@bryevdv I'll provide everything I can on Monday. Off the top of my head, I know that I'm running 3.0.4 of jupyter_bokeh because my notebook uses modules that break if I have ipywidgets 8 installed. FWIW, in my notebook I have overwritten the function call in question and can confirm that it works if the Boolean argument is labeled, but I hate running things with a bespoke patch. |
Here's the requested version information: |
Can also confirm that I get the same error with jupyter_bokeh 3.0.5, and that it occurs regardless of whether I'm using JupyterLab or classic notebook. |
Right, there are definitely still updates required for Bokeh 3.x compatibility, probably over and above this if I had to guess. But if you'd like to submit a PR for the change you describe above, that would be a helpful start. cc @ndmlny-qs |
Excellent, so no need for a PR from me, then? |
@flanabode seems not, thanks! |
I'm running into the same Full stacktrace and version info (click to expand)---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/IPython/core/formatters.py:974](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/IPython/core/formatters.py:974), in MimeBundleFormatter.__call__(self, obj, include, exclude)
971 method = get_real_method(obj, self.print_method)
973 if method is not None:
--> 974 return method(include=include, exclude=exclude)
975 return None
976 else:
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/core/dimension.py:1290](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/core/dimension.py:1290), in Dimensioned._repr_mimebundle_(self, include, exclude)
1283 def _repr_mimebundle_(self, include=None, exclude=None):
1284 """
1285 Resolves the class hierarchy for the class rendering the
1286 object using any display hooks registered on Store.display
1287 hooks. The output of all registered display_hooks is then
1288 combined and returned.
1289 """
-> 1290 return Store.render(self)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/core/options.py:1425](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/core/options.py:1425), in Store.render(cls, obj)
1423 data, metadata = {}, {}
1424 for hook in hooks:
-> 1425 ret = hook(obj)
1426 if ret is None:
1427 continue
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:280](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:280), in pprint_display(obj)
278 if not ip.display_formatter.formatters['text[/plain](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/plain)'].pprint:
279 return None
--> 280 return display(obj, raw_output=True)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:254](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:254), in display(obj, raw_output, **kwargs)
252 elif isinstance(obj, (HoloMap, DynamicMap)):
253 with option_state(obj):
--> 254 output = map_display(obj)
255 elif isinstance(obj, Plot):
256 output = render(obj)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:142](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:142), in display_hook..wrapped(element)
140 try:
141 max_frames = OutputSettings.options['max_frames']
--> 142 mimebundle = fn(element, max_frames=max_frames)
143 if mimebundle is None:
144 return {}, {}
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:202](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:202), in map_display(vmap, max_frames)
199 max_frame_warning(max_frames)
200 return None
--> 202 return render(vmap)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:69](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:69), in render(obj, **kwargs)
66 if renderer.fig == 'pdf':
67 renderer = renderer.instance(fig='png')
---> 69 return renderer.components(obj, **kwargs)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/plotting/renderer.py:400](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/plotting/renderer.py:400), in Renderer.components(self, obj, fmt, comm, **kwargs)
398 if embed or config.comms == 'default':
399 return self._render_panel(plot, embed, comm)
--> 400 return self._render_ipywidget(plot)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/plotting/renderer.py:421](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/holoviews/plotting/renderer.py:421), in Renderer._render_ipywidget(self, plot)
419 def _render_ipywidget(self, plot):
420 # Handle rendering object as ipywidget
--> 421 widget = ipywidget(plot, combine_events=True)
422 if hasattr(widget, '_repr_mimebundle_'):
423 return widget._repr_mimebundle_(), {}
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/panel/io/notebook.py:509](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/panel/io/notebook.py:509), in ipywidget(obj, doc, **kwargs)
507 doc = doc if doc else Document()
508 model = panel(obj, **kwargs).get_root(doc=doc)
--> 509 widget = BokehModel(model, combine_events=True)
510 if hasattr(widget, '_view_count'):
511 widget._view_count = 0
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:68](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:68), in BokehModel.__init__(self, model, **kwargs)
66 def __init__(self, model, **kwargs):
67 assert isinstance(model, LayoutDOM)
---> 68 self.update_from_model(model)
69 super(BokehModel, self).__init__(**kwargs)
70 self.on_msg(self._sync_model)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:91](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:91), in BokehModel.update_from_model(self, model)
89 def update_from_model(self, model):
90 self._model = model
---> 91 self.render_bundle = self._model_to_traits(model)
92 self._document.on_change_dispatch_to(self)
File [~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:81](https://vscode-remote+ssh-002dremote-002bspicy.vscode-resource.vscode-cdn.net/home/peterroelants/workspace/lcms_polymer_model/notebooks/peter/mcmc/~/mambaforge/envs/lcms_polymer_env/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:81), in BokehModel._model_to_traits(cls, model)
79 document = Document()
80 document.add_root(model)
---> 81 (docs_json, [render_item]) = standalone_docs_json_and_render_items([model], True)
82 render_bundle = dict(
83 docs_json=docs_json,
84 render_items=[render_item.to_json()],
85 div=div_for_render_item(render_item),
86 )
87 return render_bundle
TypeError: standalone_docs_json_and_render_items() takes 1 positional argument but 2 were given Version info:
EDIT: I noticed that for some reason |
Good afternoon!
For the past several days, I have been getting the following error when trying to instantiate a BokehModel from jupyter_bokeh:
(docs_json, [render_item]) = standalone_docs_json_and_render_items([model], True)
TypeError: standalone_docs_json_and_render_items() takes 1 positional argument but 2 were given.
That function (from bokeh.embed.util) is called when the BokehModel instantiation runs the following line from update_from_model:
self.render_bundle = self._model_to_traits(model)
Looking at the documentation for standalone_docs_json_and_render_items, the function setup is:
standalone_docs_json_and_render_items(models: 'Model | Document | Sequence[Model | Document]', *, suppress_calback_warning: 'bool' = False)
It seems to me that the issue could be fixed by just having the function call label the Boolean argument like so:
(docs_json, [render_item]) = standalone_docs_json_and_render_items([model], suppress_callback_warning=True)
If you agree that this would fix the issue without causing any problems, it would be much, much appreciated!
The text was updated successfully, but these errors were encountered: