Problem saving jupyter notebooks with plots

Hi everybody!

I’am new to plotly and I’am having a problem with my plots when generating them inside jupyter notebooks.

Whenever I generate a plot, evrything works fine, but when I try to save the notebook I get an error message telling me that the notebook validation failed because it’s not valid under any of the given schemas (example taken straight from the webiste).

Here is an example:

import plotly.plotly as py
iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}])

I get the following message when I try to save the notebook:

Notebook Validation failed: {u'data': [{u'y': [3, 1, 6], u'x': [1, 2, 3]}], u'layout': {}} is not valid under any of the given schemas:
 "data": [
   "y": [
   "x": [
 "layout": {}

Thank you!

Hi there –

Thanks for reporting! Which version of Jupyter are you using? Could you send us a screenshot of the error?

@chriddyp I opend an issue here: a few days ago, and inserted the error message too. Jupyter notebook version 4.3.1.


I’m using jupyter version 4.2.3 running on:

Python 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)]

Thank you!

Plotly team fixed this issue. You have to update nbformat to 4.3.0.

conda install -c anaconda nbformat
updated nbformat to this version, but
conda install -c conda-forge nbformat
installs/updates only version 4.2.0

I have tried
pip install --upgrade nbformat
As specified in the ticket and it worked perfectly.

This thread is 3 years old but I am getting this “Notebook Validation failed:” error now in 2020, with the latest nbformat (5.0.4). Upgrading didn’t help.

$ pip list | grep 'nb\|jup\|plotly'
jupyter            1.0.0      
jupyter-client     5.3.4      
jupyter-console    6.1.0      
jupyter-core       4.6.1      
nbconvert          5.6.1      
nbformat           5.0.4      
plotly             4.5.0      
widgetsnbextension 3.5.1     

Can anyone help?

To reproduce the error, here’s som Python cell code that generates the error on my laptop, but works fine on Google Colab:

import numpy as np
import plotly.graph_objects as go

N = 100 
x = np.random.normal(size=N)
y = 0.5*x + 0.2*(np.random.normal(size=N))

fig = go.Figure(data=[go.Scatter(x=x, y=y, mode='markers', 
                marker=dict(size=8,opacity=0.5), name="data" )])
fig.update_layout( xaxis_title="x", yaxis_title="y",
    yaxis = dict(scaleanchor = "x",scaleratio = 1) )

I am having the same issue when trying to commit a notebook on Kaggle. Did you ever find out what the issue was or how to fix it?

I am facing the exact same issue while committing the kernel in kaggle. I did try to update the nb viewer which did not help.

Please let me know a fix for this.


I found a workaround: Google Colab works with but does not save the (problematic) output when exporting to .ipynb files.

So any of my notebooks for which I want use, I do all my editing in Colab and then export.


But if you try to edit with regular Jupyter it’ll go bad.

Thanks for the info. Unfortunately, my problem seems to be related to metadata set behind the scenes by Kaggle since I have no trouble running my notebooks with Jupyter.

This may be helpful to you, so you can edit with Jupyter notebooks again. Check the metadata of your notebook (open it with any text editor) and make sure nbformat_minor is set to 4. I saw the suggestion in this post ( and it seemed to work for the op.

Good luck!

1 Like