AttributeError: 'Document' object has no attribute '_hold'

Hi i am getting attribute error which has something to do with environment or brwoser.

Because tmy code is minimalistic and copied from the Documentation of Holoviews website.

import pandas as pd
import numpy as np
import holoviews as hv

xs = np.linspace(0, np.pi*4, 40)
plot = hv.Area((xs, np.sin(xs)))

Error :  

AttributeError                            Traceback (most recent call last)
~\Anaconda3\lib\site-packages\IPython\core\ in __call__(self, obj, include, exclude)
    969             if method is not None:
--> 970                 return method(include=include, exclude=exclude)
    971             return None
    972         else:

~\Anaconda3\lib\site-packages\holoviews\core\ in _repr_mimebundle_(self, include, exclude)
   1314         combined and returned.
   1315         """
-> 1316         return Store.render(self)

~\Anaconda3\lib\site-packages\holoviews\core\ in render(cls, obj)
   1403         data, metadata = {}, {}
   1404         for hook in hooks:
-> 1405             ret = hook(obj)
   1406             if ret is None:
   1407                 continue

~\Anaconda3\lib\site-packages\holoviews\ipython\ in pprint_display(obj)
    280     if not ip.display_formatter.formatters['text/plain'].pprint:
    281         return None
--> 282     return display(obj, raw_output=True)

~\Anaconda3\lib\site-packages\holoviews\ipython\ in display(obj, raw_output, **kwargs)
    250     elif isinstance(obj, (CompositeOverlay, ViewableElement)):
    251         with option_state(obj):
--> 252             output = element_display(obj)
    253     elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
    254         with option_state(obj):

~\Anaconda3\lib\site-packages\holoviews\ipython\ in wrapped(element)
    144         try:
    145             max_frames = OutputSettings.options['max_frames']
--> 146             mimebundle = fn(element, max_frames=max_frames)
    147             if mimebundle is None:
    148                 return {}, {}

~\Anaconda3\lib\site-packages\holoviews\ipython\ in element_display(element, max_frames)
    190         return None
--> 192     return render(element)

~\Anaconda3\lib\site-packages\holoviews\ipython\ in render(obj, **kwargs)
     66         renderer = renderer.instance(fig='png')
---> 68     return renderer.components(obj, **kwargs)

~\Anaconda3\lib\site-packages\holoviews\plotting\ in components(self, obj, fmt, comm, **kwargs)
    408                 doc = Document()
    409                 with config.set(embed=embed):
--> 410                     model = plot.layout._render_model(doc, comm)
    411                 if embed:
    412                     return render_model(model, comm)

~\Anaconda3\lib\site-packages\panel\ in _render_model(self, doc, comm)
    426         if config.embed:
--> 427             embed_state(self, model, doc,
    428                         json=config.embed_json,
    429                         json_prefix=config.embed_json_prefix,

~\Anaconda3\lib\site-packages\panel\io\ in embed_state(panel, model, doc, max_states, max_opts, json, json_prefix, save_path, load_path, progress, states)
    303         values.append((ws, w_models, vals, getter))
--> 305     add_to_doc(model, doc, True)
    306     doc._held_events = []

~\Anaconda3\lib\site-packages\panel\io\ in add_to_doc(obj, doc, hold)
     60     remove_root(obj)
     61     doc.add_root(obj)
---> 62     if doc._hold is None and hold:
     63         doc.hold()

AttributeError: 'Document' object has no attribute '_hold'

:Area   [x]   (y)

I don’t see this problem so try update holoviews to the latest version 1.14.7.

Hi , I did upgrade Holowviews from 1.14.6 to 1.14.7.

I downloaded the Ipython NB from Holoviews Website and ran the example … Still i get attribute errors.

Can you try to update both panel and bokeh then?

Dear “unknow friend”

Many many thanks.

After updating the Panel and Bokeh, i got message " # All requested packages already installed." So i was not very optimistic while trying my Code.

Luckily, it worked very smoothly this time. My problem solved (99%).

One Question is have :

In one Notebook, I run the code df.hvplot(x=‘LONGITUDE’, y=‘LATITUDE’, kind=‘points’) and it produces an interactive plot. (zoombale); Works Perfectly Fine.

In another notebook, the same code produces an EMPTY, WHITE Cell as Output.
To generate a plot , i have to use the following workaround.

img = df.hvplot(x=‘LONGITUDE’, y=‘LATITUDE’, kind=‘points’)

Its hard to say without more information. I would properly try to clear the notebook and run the cells again. If the problem still persist I would suggest making a new topic about it with a minimal, reproducible example (MRE).

Thanks a lot for your advice. This topic can be closed for everyone’s clarity.

After Upgrading Holosview, Panel and Bokeh, my problem got resolved. Gratitude !

1 Like