Jupyter Lab JSON error saving notebook


#1

Hi guys,

I am trying to use Plotly offline with Jupyter lab and the Jupyter lab extension. Everything is smooth and works fine until I save the notebook, where it seems that the plot causes an issue in the overall Json of the notebook. I can run into the issue with the simple example:

from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
init_notebook_mode(connected=True)
iplot([{“x”: [1, 2, 3], “y”: [3, 1, 6]}])

In the shell I can see the error:

Notebook JSON is invalid: {‘x’: [1, 2, 3], ‘y’: [3, 1, 6], ‘type’: ‘scatter’, ‘uid’: ‘22e994e2-b776-11e8-800b-8c8590492a0e’} is not valid under any of the given schemas

Failed validating ‘oneOf’ in display_data[‘properties’][‘data’][‘additionalProperties’]:

On instance[‘cells’][0][‘outputs’][1][‘data’][‘0’]:
{‘type’: ‘scatter’,
‘uid’: ‘22e994e2-b776-11e8-800b-8c8590492a0e’,
‘x’: [1, 2, 3],
‘y’: [3, 1, 6]}

It does not prevent the notebook to be saved. However if one reopen the notebook, the plot is now some fixed image, some type of png is inserted in the data section of the JSON instead of the html code.

Using the regular jupyter notebook however seems to work quite well (saving a reloading notebook with offline Plotly inside)

Does anyone already run into this issue? Is there a way to fix it?

Thanks!


#2

Hi @gmoille, I see what you mean. Based on the error message I’m guessing that there’s some kind of name conflict going on.

Could you open an issue in the repo for the JupyterLab extension. This extension has been maintained by some of the Jupyter folks, and I’m hoping they’ll have some more insight into what this error message means.

Thanks!
-Jon


#3

Hi Jon,

Thank you for the answer. For the record, I opened an issue in the renderers JupyterLab extension repo on GitHub https://github.com/jupyterlab/jupyter-renderers/issues/158