Holoviews: Cannot export holomap

Created on 31 Mar 2020  路  18Comments  路  Source: holoviz/holoviews

import holoviews as hv
hv.extension('matplotlib')
hv.save(xr.tutorial.open_dataset('air_temperature').isel(time=slice(0, 3)).hvplot('lon', 'lat', dynamic=False), 'testmpl.html')

Seems like bokeh is failing too.

holoviews=='1.13.1'
panel=='0.9.3'
bokeh=='2.0.1'

All 18 comments

Can't reproduce, can you provide some details on what exactly is failing.

import hvplot.xarray
import holoviews as hv
import xarray as xr
hv.extension('matplotlib')
hv.save(xr.tutorial.open_dataset('air_temperature').isel(time=slice(0, 3)).hvplot('lon', 'lat', dynamic=False), 'testmpl.html')

I just tried on another machine; Successfully installed bokeh-2.0.1 geoviews-1.8.1 holoviews-1.13.1

Sorry for the incomplete bug report. If you try opening the exported file, nothing shows and if you look at the console log:

bokeh-2.0.1.min.js:158 Uncaught (in promise) Error: Model 'panel.models.state.State' does not exist. This could be due to a widget or a custom model not being registered before first usage.
    at Object.s.Models (bokeh-2.0.1.min.js:158)
    at Function._instantiate_object (bokeh-2.0.1.min.js:157)
    at Function._instantiate_references_json (bokeh-2.0.1.min.js:157)
    at Function.from_json (bokeh-2.0.1.min.js:157)
    at g (bokeh-2.0.1.min.js:155)
    at bokeh-2.0.1.min.js:155
    at bokeh-2.0.1.min.js:180

Okay, I can reproduce now. Definitely a major bug, not sure when that regressed because this was working for a long time. Suspect it might be because hv.save uses the CDN by default, switching to resources='inline' might work.

The real fix will be to publish panel.js to NPM as is already planned.

@ahuang11 Could you try again? I just published panel.js to npm so your already generated file should now load.

That said I think embed was broken for HTML models and I'll have to push out Panel 0.9.4 to fix it.

I think it's still broken; still getting:

import hvplot.xarray
import holoviews as hv
import xarray as xr
hv.extension('matplotlib')
hv.save(xr.tutorial.open_dataset('air_temperature').isel(time=slice(0, 3)).hvplot('lon', 'lat', dynamic=False), 'testmaapl.html', resources='inline')

I also tried resources='inline' but same

testmaapl.html:646 Uncaught (in promise) Error: Model 'panel.models.state.State' does not exist. This could be due to a widget or a custom model not being registered before first usage.
    at Object.s.Models (testmaapl.html:646)
    at Function._instantiate_object (testmaapl.html:645)
    at Function._instantiate_references_json (testmaapl.html:645)
    at Function.from_json (testmaapl.html:645)
    at g (testmaapl.html:643)
    at testmaapl.html:643
    at testmaapl.html:668

Yeah I just realized that Panel 0.9.3 doesn't declare where it would get the CDN package from. Will tag 0.9.4 tomorrow.

I also tried resources='inline' but same.

That seems to be a different bug passing this in as resources should work:

from bokeh.resources import INLINE

By the way if it helps, it works with holoviews<1.13 and other dependencies to export

INLINE also didn't work for me.

import hvplot.xarray
import holoviews as hv
import xarray as xr
hv.extension('bokeh')
from bokeh.resources import INLINE
hv.save(xr.tutorial.open_dataset('air_temperature').isel(time=slice(0, 3)).hvplot('lon', 'lat', dynamic=False), 'testmaapl.html', resources=INLINE)

HoloViews <1.13 renders using the old non-panel based widgets. In 1.13 we completely removed the widget and HoloMap exporting implementation in HoloViews and replaced it with panel.

Anyway, thanks. I should be able to fix all of the issues with a new Panel release.

Will close as the new releases are almost ready. Please reopen if issues persist with Panel 0.9.4 and HoloViews 1.13.2.

Without resources='inline', I'm still getting the same error. Is that expected?

I can't reproduce, you definitely have HoloViews 1.13.2 and Panel 0.9.4?

It works with resources='inline', but if I remove that keyword,

Uncaught (in promise) Error: Model 'panel.models.state.State' does not exist. This could be due to a widget or a custom model not being registered before first usage.
    at Object.s.Models (bokeh-2.0.1.min.js:158)
    at Function._instantiate_object (bokeh-2.0.1.min.js:157)
    at Function._instantiate_references_json (bokeh-2.0.1.min.js:157)
    at Function.from_json (bokeh-2.0.1.min.js:157)
    at g (bokeh-2.0.1.min.js:155)
    at bokeh-2.0.1.min.js:155
    at bokeh-2.0.1.min.js:180
import hvplot
import hvplot.xarray
import holoviews as hv
import xarray as xr
import panel as pn
hv.__version__
hvplot.__version__
pn.__version__
hv.save(xr.tutorial.open_dataset('air_temperature').isel(
    time=slice(0, 3)).hvplot('lon', 'lat', dynamic=False),
        'testmaapl.html'
       )
'1.13.2'
'0.5.2'
'0.9.4'             

Oh right, CDN is the default sadly. I'll have to hurry up and release Panel 0.9.5, as NPM won't let me upload a 0.9.4 package anymore.

Thanks I appreciate it.

Should be fixed now, please reopen if necessary.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jlstevens picture jlstevens  路  6Comments

hojo0590 picture hojo0590  路  4Comments

ericmjl picture ericmjl  路  3Comments

ahuang11 picture ahuang11  路  3Comments

ceh-creare picture ceh-creare  路  5Comments