nteract / commuter

🚎 Notebook sharing hub
BSD 3-Clause "New" or "Revised" License
495 stars 66 forks source link

Commuter does not render plots backed by javascript (such as bokeh plots) #255

Closed mstewart141 closed 5 years ago

mstewart141 commented 5 years ago

hello all, i am using commuter to serve some jupyter notebooks from s3. it works great (if one builds from source anyway).

the problem i am having is some of my notebooks have interactive plots generated by bokeh that include javascript. in a normal html-ified-notebook these plots only display properly (in all their javascripty glory) after running jupyter trust mynotebook.ipynb.

i am wondering how i can effect that for commuter? basically, i think i need to tell commuter i trust these notebooks and that all the JS should be loaded. any advice to resolve this appreciated!! thanks all 😄

Addendum: this ticket (https://github.com/bokeh/bokeh/issues/8392) details my interactions with the bokeh team, in which they clued me in to jupyter trust which allows JS dynamic plots to render in notebooks that were run by nteract/papermill but are not displayed by nteract/commuter.

captainsafia commented 5 years ago

Hello @mstewart141 and thanks for opening this issue and discussing this with the Bokeh team.

Jupyter Classic implements a trust mechanism that prevents outputs with code from being executed if the user did not run the cells themselves. The jupyter trust command is a way of circumventing that and saying you trust all content in the notebook regardless of whether or not you've run the cells yourself.

nteract doesn't currently implement this notebook trust mechanism so I don't think that is the issue. I suspect that something is going on with the JavaScript transform that is preventing it from rendering the Bokeh plot.

Do you have an example output notebook that you can share to help with debugging?

mstewart141 commented 5 years ago

thanks safia, big fan of your work. i will close this now; we eventually got this working and there were no hard blockers in the end. one related problem that i had was that commuter seemed to be rearranging some of the JS-backed-plot dom elements (think bokeh plots) such that they were appended to the bottom of the notebook rather than inlined after the particular notebook cell that computed the given plot. i do not believe i have enough info to open a super helpful ticket, however.

thanks again!

tanguycdls commented 5 years ago

Hi @mstewart141 we have a similar problem with Commuter and Papermill fro bokeh plots generated by Holoviews. I tried the tricks in your bokeh ticket but it still does not plot in Commuter. How did you manage to make it work, I can open a new ticket if you prefer. Thks

mstewart141 commented 5 years ago

hi, the bokeh ticket is all the info i have really, sorry!

tanguycdls commented 5 years ago

No problem @mstewart141 I will try again the tricks in the ticket ! Thanks a lot for the prompt answer !