pyviz_comms icon indicating copy to clipboard operation
pyviz_comms copied to clipboard

Limited support using the Code Console in JupyterLab

Open iuryt opened this issue 2 years ago • 4 comments

Thanks for contacting us! Please read and follow these instructions carefully, then delete this introductory text to keep your issue easy to read. Note that the issue tracker is NOT the place for usage questions and technical assistance; post those at Discourse instead. Issues without the required information below may be closed immediately.

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)

I basically followed https://hvplot.holoviz.org/getting_started/installation.html

and installed everything with

conda create -n hvplot-env -c conda-forge -c nodefaults hvplot geoviews datashader xarray pandas geopandas dask streamz networkx intake intake-xarray intake-parquet s3fs scipy spatialpandas pooch rasterio fiona plotly matplotlib jupyterlab

Description of expected behavior and the observed behavior

Then following

https://hvplot.holoviz.org/

I tried

import hvplot.xarray
import panel as pn
import xarray as xr

da = xr.tutorial.open_dataset('air_temperature').air
w_quantile = pn.widgets.FloatSlider(name='quantile', start=0, end=1)
w_time = pn.widgets.IntSlider(name='time', start=0, end=10)

da.interactive(loc='left') \
.isel(time=w_time) \
.quantile(q=w_quantile, dim='lon') \
.hvplot(ylabel='Air Temperature [K]', width=500)

But this is on a .py file on a JupyterLab that I am running using the console for editor which pops up a notebook that is used to run the code.

Complete, minimal, self-contained example code that reproduces the issue

The code was provided in the previous session.

Stack traceback and/or browser JavaScript console output

Not sure if this is what you are asking fo

[bokeh] document idle at 978 ms
3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2 TypeError: i[r] is not a function
    at Object.n [as delegateLabel] (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:734214)
    at caption (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:731800)
    at e.caption (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:1326754)
    at Object.t [as propsFromCommand] (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:124476)
    at Object.children (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:122762)
    at x.render (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:81583)
    at ho (3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2:74183)
    at po (3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2:73980)
    at ds (3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2:110364)
    at Ji (3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2:101464)
Mo @ 3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2
jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2 TypeError: i[r] is not a function
    at Object.n [as delegateLabel] (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:734214)
    at caption (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:731800)
    at e.caption (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:1326754)
    at Object.t [as propsFromCommand] (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:124476)
    at Object.children (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:122762)
    at x.render (jlab_core.fa2ded6823988d66523d.js?v=fa2ded6823988d66523d:2:81583)
    at ho (3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2:74183)
    at po (3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2:73980)
    at ds (3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2:110364)
    at Ji (3935.4159b022aa6d82e44127.js?v=4159b022aa6d82e44127:2:101464)

Screenshots or screencasts of the bug in action

ezgif com-video-to-gif

ezgif com-video-to-gif (1)

  • [ ] I may be interested in making a pull request to address this

iuryt avatar Oct 17 '23 15:10 iuryt

Hi @iuryt,

Thanks for opening this issue. I'm not sure I ever used the Code console in Jupyter Lab :) ! I also thought I was just a regular IPython console, it turns out it's more than that as you can't display HoloViews plots in an IPython terminal or Qt console.

I'm moving this issue to another repository that holds the extension responsible for the interactivity you usually get in a notebook. Note that I'm not sure it's going to be possible to support having interactivity in the Jupyter Lab Code Console, so until then the workaround is to directly work in a notebook instead of in the Code Console.

maximlt avatar Oct 18 '23 06:10 maximlt

I moved this issue from hvPlot to here. I have no clue whether supporting full interactivity in the Jupyter Lab Code Console is possible 🙃

  • Console code: https://github.com/jupyterlab/jupyterlab/tree/main/packages/console
  • Console extension code: https://github.com/jupyterlab/jupyterlab/tree/main/packages/console-extension

maximlt avatar Oct 18 '23 06:10 maximlt

Thanks! I am using the notebook now, but it took a while for me to realize that was not a problem on my browser. Haha

iuryt avatar Oct 18 '23 09:10 iuryt

Yes, maybe there's a way to detect when the code is executed from within the Code Console and log/warn about the limited support.

maximlt avatar Oct 18 '23 15:10 maximlt