Gave a live demo today during a presentation and the zoom/rescale feature didn’t work (which I usually tell people is one of the “killer features” of hvplot/datashader).
I told the gathered folks that it was a metadata caching issue in the notebook (because that’s what I thought), but when I tried the usual approach to fixing issues like this (like blank output), it didn’t fix the problem.
I then tried a simple reproducible test, and sure enough it didn’t work either:
(pangeo) rsignell@OSC:~$ conda list | grep -E "holoviews|geoviews|hvplot|bokeh|datashader|panel|widget"
bokeh 3.4.1 pyhd8ed1ab_0 conda-forge
datashader 0.16.2 pyhd8ed1ab_0 conda-forge
geoviews 1.12.0 pyhd8ed1ab_0 conda-forge
geoviews-core 1.12.0 pyha770c72_0 conda-forge
holoviews 1.19.0 pyhd8ed1ab_0 conda-forge
hvplot 0.10.0 pyhd8ed1ab_0 conda-forge
ipywidgets 8.1.3 pyhd8ed1ab_0 conda-forge
jupyter-panel-proxy 0.1.0 py_0 conda-forge
jupyter_bokeh 4.0.5 pyhd8ed1ab_0 conda-forge
jupyterlab_widgets 3.0.11 pyhd8ed1ab_0 conda-forge
panel 1.4.4 pyhd8ed1ab_0 conda-forge
widgetsnbextension 4.0.11 pyhd8ed1ab_0 conda-forge
Do the developer console messages give a clue to what is going wrong?
Hmm, good question. The “Connection Lost” message seems to indicate that the kernel simply disconnected which would explain this of course.
@philippjf
On a completely different system, I just tried creating a fresh environment:
mamba create -n hvplot python=3.11 hvplot geoviews holoviews datashader panel bokeh xarray ipykernel pooch
and running the above code it has the same problem.
Here to confirm what @rsignell is saying
mamba create -n hvplot python=3.11 hvplot geoviews holoviews datashader panel bokeh xarray ipykernel pooch
import hvplot.xarray
import xarray as xr
ds = xr.tutorial.open_dataset('air_temperature')
ds['air'].hvplot(x='lon', y='lat', geo=True, rasterize=True)
plot doesn’t resample. I thought it might be due to numpy’s 2.0 release (mamba downloaded 2.0 unprompted) but reverting to numpy==1.26.4 has the same plotting issue. Using the same environment, I plotted some of my own data after opening it with xarray- the resampling issue isn’t present.
Hmm, just tried this and I actually do see it resample but see this issue: Fix x ranges upon projection by ahuang11 · Pull Request #722 · holoviz/geoviews · GitHub
I’ll release GeoViews 1.12.1 asap but that still doesn’t resolve the mystery of what you’re seeing.
@philippjfr My tests were done in jupyterlab in a notebook. Could that be the difference between what you and I are seeing?
Same here, I noticed that the environment you specified above does not have jupyterlab in it though.
I use my base
conda environment to launch jupyterlab and I make sure my base
environment has nb_conda_kernels
.
I also have a collection of different kernels I use for different workflows and each of them has ipykernel
, which allows them to be “seen” from the jupyterlab environment and be selected from the pick list in the notebook.
Do you think this might be the issue? Perhaps my base
environment is missing something that it needs…
Whoa, that’s it! I added jupyterlab
to the hvplot
environment:
mamba create -n hvplot python=3.11 hvplot geoviews holoviews datashader panel bokeh xarray ipykernel pooch
and when I launched jupyter from that environment, the resampling worked!
Here’s the difference between my base
environment and the hvplot
environment:
(base) rsignell@OSC:~$ conda list | grep -E "widgets|bokeh|jupyter"
bokeh 3.4.1 pyhd8ed1ab_0 conda-forge
ipywidgets 8.1.1 pyhd8ed1ab_0 conda-forge
jupyter-forward 2022.9.10 pyhd8ed1ab_0 conda-forge
jupyter-lsp 2.2.1 pyhd8ed1ab_0 conda-forge
jupyter-server-proxy 4.1.0 pyhd8ed1ab_0 conda-forge
jupyter_bokeh 4.0.5 pyhd8ed1ab_0 conda-forge
jupyter_client 8.6.0 pyhd8ed1ab_0 conda-forge
jupyter_core 5.7.0 py310hff52083_0 conda-forge
jupyter_events 0.9.0 pyhd8ed1ab_0 conda-forge
jupyter_server 2.12.2 pyhd8ed1ab_0 conda-forge
jupyter_server_terminals 0.5.1 pyhd8ed1ab_0 conda-forge
jupyterlab 4.2.2 pyhd8ed1ab_0 conda-forge
jupyterlab_pygments 0.3.0 pyhd8ed1ab_0 conda-forge
jupyterlab_server 2.27.2 pyhd8ed1ab_0 conda-forge
jupyterlab_widgets 3.0.9 pyhd8ed1ab_0 conda-forge
widgetsnbextension 4.0.9 pyhd8ed1ab_0 conda-forge
(hvplot) rsignell@OSC:~$ conda list | grep -E "widgets|bokeh|jupyter"
bokeh 3.4.1 pyhd8ed1ab_0 conda-forge
jupyter-lsp 2.2.5 pyhd8ed1ab_0 conda-forge
jupyter_client 8.6.2 pyhd8ed1ab_0 conda-forge
jupyter_core 5.7.2 py311h38be061_0 conda-forge
jupyter_events 0.10.0 pyhd8ed1ab_0 conda-forge
jupyter_server 2.14.1 pyhd8ed1ab_0 conda-forge
jupyter_server_terminals 0.5.3 pyhd8ed1ab_0 conda-forge
jupyterlab 4.2.2 pyhd8ed1ab_0 conda-forge
jupyterlab_pygments 0.3.0 pyhd8ed1ab_1 conda-forge
jupyterlab_server 2.27.2 pyhd8ed1ab_0 conda-forge
Is it no longer necessary to have widgets?
Okay, I explored this some more and I’m totally confused.
I created a new environment with jupyter:
mamba create -n jupyter python=3.11 jupyterlab nb_conda_kernels
activated this environment, and started jupyterlab. I then selected the hvplot
environment and ran the test. It did not rescale.
I hope the answer is that we now have to start jupyterlab from the environment that the notebook is running. That won’t work too well on jupyterhubs!
Hoxbro
June 22, 2024, 2:41pm
11
Does your base/jupyter environment have pyviz-comms and panel in it?
Yep, pyviz_comms
has to be installed in the environment JupyterLab is launched from.
That’s it! Woohoo!!! Thanks for clearing up this mystery!
We’ll have to make that clearer in the docs. I think we’ve tried before but since it crops up semi-frequently we should make it as visible as we can.
The Jupyter Lab + pyviz_comms
solution didn’t work for me. I use a similar set up to @rsignell : launch Jupyter Lab from base, attach other environments via ipykernel
.
Also, I am experiencing this same rendering problem when I display the plot in a panel app launched with panel serve app.py
.
import panel as pn
import hvplot.xarray
import xarray as xr
ds = xr.tutorial.open_dataset('air_temperature')
plot = ds['air'].hvplot(x='lon', y='lat', geo=True, rasterize=True)
class App(pn.viewable.Viewer):
def __init__(self, **params):
super().__init__(**params)
self._template = pn.template.FastListTemplate(
main=[plot]
)
def __panel__(self):
return self._template
App().servable()
Hoxbro
June 24, 2024, 2:39pm
16
I don’t see the problem.
Can you report what you see with import holoviews as hv; hv.show_versions()
?