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

JavaScript output is disabled in JupyterLab #917

Closed
dhirschfeld opened this issue Jun 28, 2021 · 6 comments
Closed

JavaScript output is disabled in JupyterLab #917

dhirschfeld opened this issue Jun 28, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@dhirschfeld
Copy link

I'm trying to show a bokeh plot in an ipywidget.Output and to render that with voila (in JupyterLab):

import bokeh.plotting as plt
import ipywidgets as widgets

plt.output_notebook()

x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
fig = plt.figure(
    title="Simple line example",
    x_axis_label='x',
    y_axis_label='y',
)
fig.line(x, y, legend_label="Temp.", line_width=2)
out = widgets.Output()
with out:
    plt.show(fig)

out

In the notebook it renders fine:

image

...but voila gives a JavaScript output is disabled in JupyterLab error:

image

It would be a pretty big limitation if you can't use ipywidgets in a voila app! Is there a way to get this to work?

@dhirschfeld dhirschfeld added the enhancement New feature or request label Jun 28, 2021
@jtpio
Copy link
Member

jtpio commented Jun 28, 2021

Thanks @dhirschfeld.

It would be a pretty big limitation if you can't use ipywidgets in a voila app! Is there a way to get this to work?

Probably this is an issue with Bokeh? iirc this was also mentioned before in #244 with links to an ipybokeh project.

Jupyter Widgets have been working in Voila since the very start, with some example notebooks in https://github.com/voila-dashboards/voila/tree/master/notebooks

@jtpio
Copy link
Member

jtpio commented Jun 28, 2021

iirc this was also mentioned before in #244 with links to an ipybokeh project.

Ah looks like https://github.com/philippjfr/ipybokeh is now archived and https://github.com/bokeh/jupyter_bokeh is the new repo.

@dhirschfeld
Copy link
Author

I've got jupyter_bokeh installed

image

...from that issue it seems like bokeh might not be compatible. From my testing when using a widgets.Output I get the JavaScript error but when just using plt.show(fig) directly I see the below error in the js console of the gridstack app:

Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing

I'll close this now as I think it may just be that bokeh isn't fully compatible with ipywidgets/voila :/

@jtpio
Copy link
Member

jtpio commented Jun 28, 2021

Thanks for checking 👍

I'll close this now as I think it may just be that bokeh isn't fully compatible with ipywidgets/voila :/

Maybe this will improve when Voila becomes a JupyterLab based app (#846) so it can reuse prebuilt lab extensions directly.

@dhirschfeld
Copy link
Author

Maybe this will improve when Voila becomes a JupyterLab based app (#846)

Thanks for the pointer, that looks promising indeed - subscribed! 👀

@dhirschfeld
Copy link
Author

NB: I also didn't have any luck displaying a perspective widget so that issue seems a likely culprit.

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

No branches or pull requests

2 participants