Python 在jupyter笔记本中使用plotly时验证失败

Python 在jupyter笔记本中使用plotly时验证失败,python,jupyter-notebook,plotly,Python,Jupyter Notebook,Plotly,当我保存带有plotly graph的jupyter笔记本时,出现以下错误: [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']

当我保存带有plotly graph的jupyter笔记本时,出现以下错误:

[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': {}}
我在笔记本中的代码是:

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)

接下来,我更新了nbformat,但仍然不工作(我使用更新有效的
import nbformat
nbformat\uuuuuu版本\uuuuuu
进行了检查)

我遇到了同样的问题。我试着更新nbformat,甚至是conda更新——但这些都没有帮助

后来我得到了一个链接:。
因此,我用文本编辑器打开了ipynb文件,将“nbformat_minor”:1替换为“nbformat_minor”:4并保存了该文件。重新加载笔记本后,问题得到了解决。

我遇到了另一个错误-

Notebook validation failed: {'type': 'string'} is not valid under any of the given schemas: { "type": "string" }

但是用“nbformat_minor”:4替换“nbformat_minor”:1对我来说很有效。

我也有同样的问题。将这些示例中的任何一个复制并粘贴到jupyter笔记本(并将最后一行更改为脱机打印)都会复制验证错误。这个“黑客”对我也有用,谢谢!你知道这是什么吗?它是否与所使用的nbformat版本相关,也可以通过conda或pip安装正确的版本设置为“globaly”?@Hellvetia,很遗憾,我不知道。可能它会将保存模式切换到“脱机”或类似的模式。如果你发现了,请告诉我们!