'plotly plots in jupyter notebooks: Validation fails when saving
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 plot.ly 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": [
3,
1,
6
],
"x": [
1,
2,
3
]
}
],
"layout": {}
}
Thank you!
Solution 1:[1]
The ploty team fixed the issue, here is the ticket
Upgrading nbformat, with either
pip install --upgrade nbformat
or
conda update nbformat
fixes it.
Solution 2:[2]
I got the same problem but the answer above didn't help me. I tried then conda update --all but this didn't help too.
Later I was given the 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.
Solution 3:[3]
As in gerard's answer pip install --upgrade nbformat solved the issue, however conda (which I tried before pip) didn't solve the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | gerard baste |
| Solution 2 | |
| Solution 3 | Zilbert97 |
