When I save a jupyter notebook with a plotly graph, I get the following error:
[E 13:42:38.458 NotebookApp] Notebook JSON is invalid: {'data': [{'type': 'scatter', 'y': [1, 2, 3]}], 'layout': {}} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['data']['patternProperties']['^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$']:
{'oneOf': [{'type': 'string'},
{'items': {'type': 'string'}, 'type': 'array'}]}
On instance['data']['application/vnd.plotly.v1+json']:
{'data': [{'type': 'scatter', 'y': [1, 2, 3]}], 'layout': {}}
My code in the notebook is :
import plotly.offline as py
import plotly.graph_objs as go
py.init_notebook_mode(connected=True)
data = [go.Scatter(y=[1,2,3])]
py.iplot(data)
Following plotly plots in jupyter notebooks: Validation fails when saving, I updated nbformat but still not working (I checked with import nbformat
nbformat__version__
that the update worked)
I got the same problem. I tried updating nbformat and even conda update --all but this didn't help too.
Later I was given a link: https://gitmemory.com/issue/jupyter/nbformat/161/574959380. So, I opened ipynb file with text editor, replaced "nbformat_minor": 1 with "nbformat_minor": 4 and saved the file. After reloading the notebook the problem was fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With