-
Notifications
You must be signed in to change notification settings - Fork 48
Spike: See what it would take to have plot.ly, bokeh, matpotlib work #108
Comments
matplotlib request in ipywidgets: jupyter-widgets/ipywidgets#378 |
Here's a related conversation on the Plotly side of things: plotly/plotly.py#408 |
You should be able to used the output widget to capture these things. Have you tried that yet? |
@jdfreder Have not. We're using the jupyter-js-notebook OutputAreaModel/View as the top-level wrapper for dashboard "cells". Are you saying that putting OutputWidget in those cells where we know there's custom JS coming from the backend will help somehow? Most of the problem I see with matplotlib's notebook implementation, for example, is that it makes direct references to |
Ah no, it's my fault, I misread what the problem was - the missing globals. I thought you were having trouble capturing the output because a lack of an output area. Sounds like you've got that covered though. |
An outcome I'd like to see from this is a statement of compatibility in the README here about what libraries we do and don't work with. I don't think we're going to be able to make everything work during the transition period in which libraries are adapting from working in classic notebook to alternative application containers (jupyter lab, standalone, ...) |
Try adding more functions here with good comments about what shims are provided and for what library. |
For matplotlib, I was able to add some shim code alongside the DeclWidgets shims in our widget manager. It's mostly just stubbing out some notebook functionality that dashboard server doesn't support, but one function does need to access output area data which requires us to poke into the internals of the output area (phosphor observable list) to extract the required data. It also requires a list of all output areas. I extracted a list from the existing _pendingExecution object, but we may want to look into storing those in a dedicated place for when they are needed. Initial shim code can be seen in dalogsdon@d0e13e5. |
Thanks for giving this a shot. That's not a terrible starting shim for matplotlib. Now I wonder what it looks like if you do bokeh too. Any overlap or all new shims? |
For Bokeh things mostly worked. It accessed the comm manager from There is a comm-related error causing I'm currently digging into this issue to see if we can get the target registered or the handler delayed until it is registered. |
Ah, I didn't notice that the same error happens in the notebook (initial run doesn't work with the interact sliders). I'm seeing it work only when re-running the notebook cells. @parente @nitind Is this a known issue? Also, the link to a Bokeh example does not work from the |
The actual error I am seeing is:
Looks like the same error is happening in the notebook. |
The error doesn't happen when running cells individually, specifically when running The issue bokeh/bokeh#3639 gives the same error in other cases and looks to be related to the loading of JS from an external (CDN) source. An inline option is mentioned; I can see if that is possible for us to set. |
One way to solve it is to use inline mode by calling |
There is also a rendering issue since Bokeh uses a table and the output area has the class |
My initial thought was to somehow monkey-patch Bokeh to wait for its scripts to load before executing anything. But this is probably going to be an issue with other toolkits as well. So here's my new proposal: we execute all code cells in a loop, then wait for result to come back and pass that to This would be a generic solution to this issue that would work for Bokeh as well as other toolkits. |
@jhpedemonte This is an interesting potential solution. I opened #135 to investigate. For this issue we can recommend specific coding style to make things work. |
Trying plotly, I am able to get it working in the notebook, but there is an issue that breaks dashboards because it undefines requirejs globals (see comments above). They do have a fix in plotly/plotly.py#412, but it is not yet released. |
I'm also seeing the "run all" problem like with Bokeh. The plot does not render because it is looking for a global |
The problem with 'run all' with plotly was that requirejs was used to create a 'plotly' module, and then the plotly module was required to set |
I opened a PR with the libraries working and with an example notebook showing all 3. Currently still 2 issues:
|
🍻 for the other bug reports and 2 line fix. |
FYI going to push a PR to Bokeh today to add update see bokeh/bokeh#4144 |
matplotlib notebook mode references
IPython.notebook.kernel.*
. I suspect the others do similar things. What shims would we need to provide to have the three libs in the title work in the dashboard server?The text was updated successfully, but these errors were encountered: