Skip to content
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

[Multiplot Error] Not able to run the multiplot visualization example #162

Closed
sara-02 opened this issue May 17, 2020 · 0 comments
Closed
Labels

Comments

@sara-02
Copy link

sara-02 commented May 17, 2020

Describe the bug
While running the Multiplot visualization example in the tutorial, I am getting the following error.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-6-a6f8d12c6bbd> in <module>
      4 vm.add_plot(p2)
      5 m = vm.plot()
----> 6 show(m)

/usr/local/lib/python3.6/dist-packages/bokeh/io/showing.py in show(obj, browser, new, notebook_handle, notebook_url, **kw)
    137         return run_notebook_hook(state.notebook_type, 'app', obj, state, notebook_url, **kw)
    138 
--> 139     return _show_with_state(obj, state, browser, new, notebook_handle=notebook_handle)
    140 
    141 #-----------------------------------------------------------------------------

/usr/local/lib/python3.6/dist-packages/bokeh/io/showing.py in _show_with_state(obj, state, browser, new, notebook_handle)
    175 
    176     if state.file or not shown:
--> 177         _show_file_with_state(obj, state, new, controller)
    178 
    179     return comms_handle

/usr/local/lib/python3.6/dist-packages/bokeh/io/showing.py in _show_file_with_state(obj, state, new, controller)
    158 
    159     '''
--> 160     filename = save(obj, state=state)
    161     controller.open("file://" + filename, new=NEW_PARAM[new])
    162 

/usr/local/lib/python3.6/dist-packages/bokeh/io/saving.py in save(obj, filename, resources, title, template, state, **kwargs)
     83 
     84     filename, resources, title = _get_save_args(state, filename, resources, title)
---> 85     _save_helper(obj, filename, resources, title, template)
     86     return abspath(filename)
     87 

/usr/local/lib/python3.6/dist-packages/bokeh/io/saving.py in _save_helper(obj, filename, resources, title, template)
    145     '''
    146     from ..embed import file_html
--> 147     html = file_html(obj, resources, title=title, template=template)
    148 
    149     with io.open(filename, mode="w", encoding="utf-8") as f:

/usr/local/lib/python3.6/dist-packages/bokeh/embed/standalone.py in file_html(models, resources, title, template, template_variables, theme, suppress_callback_warning, _always_new)
    301         models_seq = models
    302 
--> 303     with OutputDocumentFor(models_seq, apply_theme=theme, always_new=_always_new) as doc:
    304         (docs_json, render_items) = standalone_docs_json_and_render_items(models_seq, suppress_callback_warning=suppress_callback_warning)
    305         title = _title_from_models(models_seq, title)

/usr/lib/python3.6/contextlib.py in __enter__(self)
     79     def __enter__(self):
     80         try:
---> 81             return next(self.gen)
     82         except StopIteration:
     83             raise RuntimeError("generator didn't yield") from None

/usr/local/lib/python3.6/dist-packages/bokeh/embed/util.py in OutputDocumentFor(objs, apply_theme, always_new)
    132             doc = Document()
    133             for model in objs:
--> 134                 doc.add_root(model)
    135 
    136         # handle a single shared document

/usr/local/lib/python3.6/dist-packages/bokeh/document/document.py in add_root(self, model, setter)
    317             self._roots.append(model)
    318         finally:
--> 319             self._pop_all_models_freeze()
    320         self._trigger_on_change(RootAddedEvent(self, model, setter))
    321 

/usr/local/lib/python3.6/dist-packages/bokeh/document/document.py in _pop_all_models_freeze(self)
   1054         self._all_models_freeze_count -= 1
   1055         if self._all_models_freeze_count == 0:
-> 1056             self._recompute_all_models()
   1057 
   1058     def _recompute_all_models(self):

/usr/local/lib/python3.6/dist-packages/bokeh/document/document.py in _recompute_all_models(self)
   1077             d._detach_document()
   1078         for a in to_attach:
-> 1079             a._attach_document(self)
   1080         self._all_models = recomputed
   1081         self._all_models_by_name = recomputed_by_name

/usr/local/lib/python3.6/dist-packages/bokeh/model.py in _attach_document(self, doc)
    669         '''
    670         if self._document is not None and self._document is not doc:
--> 671             raise RuntimeError("Models must be owned by only a single document, %r is already in a doc" % (self))
    672         doc.theme.apply_to_model(self)
    673         self._document = doc

RuntimeError: Models must be owned by only a single document, BoxZoomTool(id='1020', ...) is already in a doc

To Reproduce
Steps to reproduce the behavior:

  • NDlib version: 5.0.2
  • Operating System: Linux
  • Python version: 3.6
  • Bokeh: 2.0.2
    Sample code that is giving the error:
from ndlib.viz.bokeh.MultiPlot import MultiPlot
vm = MultiPlot()
vm.add_plot(p)
vm.add_plot(p2)
m = vm.plot()
show(m)

The code is present under: Tutorial

Expected behavior
We should be able to generate the bokeh plot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants