Skip to content

jsonschema.SchemaError when a figure is validated #692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
empet opened this issue Feb 12, 2017 · 15 comments
Closed

jsonschema.SchemaError when a figure is validated #692

empet opened this issue Feb 12, 2017 · 15 comments

Comments

@empet
Copy link

empet commented Feb 12, 2017

Here is a minimal example that reproduces the bug: http://nbviewer.jupyter.org/gist/empet/cf922d7c7f4269d6f63432ec67a5d020

The notebook runs OK (with plotly 2.0.1) when I call plot(fig). iplot(fig) generates the plot too, but an error box pops up whenever Jupyter tries to save the notebook. The box has the following content:

The save operation succeeded, but the notebook does not appear to be valid. The validation error was:
Notebook Validation failed
:
u'data': [{u'colorscale': u'Viridis', u'z': [[2, 27, 105, 100], [87, 14, 121, 102], [26, 121, 73, 34], [44, 105, 111, 127]], u'type': u'heatmap', u'zsmooth': u'best'}], u'layout': {u'width': 400, u'height': 400}} is not valid under any of the given schemas:

{ "data": [ { "colorscale": "Viridis", "z": [ [ 2, 27, 105, 100 ], [ 87, 14, 121, 102 ], [ 26, 121, 73, 34 ], [ 44, 105, 111, 127 ] ], "type": "heatmap", "zsmooth": "best" } ], "layout": { "width": 400, "height": 400 } }

Initially I formulated this issue only for heatmaps, but meanwhile I realized that this behaviour manifests for any type of plot.

@empet empet changed the title jsonschema.SchemaError when a figure defining heatmap is validated jsonschema.SchemaError when a figure is validated Feb 13, 2017
@cldougl
Copy link
Member

cldougl commented Feb 20, 2017

cc @chriddyp

screen shot 2017-02-20 at 2 27 11 pm

@chriddyp
Copy link
Member

yikes, I suspect that this was introduced with adding the Nteract plugin. @theengineear @rgbkrk , does that sound right? Any thoughts on how to get around this issue?

@rgbkrk
Copy link
Contributor

rgbkrk commented Feb 20, 2017

Upgrade nbformat, either with pip install --upgrade nbformat or conda update nbformat.

chriddyp added a commit that referenced this issue Feb 20, 2017
include nbformat in `install_requires` as dependency to fix #692
@malindho
Copy link

I've updated nbformat (to 4.2.0) and am still seeing this issue. I had not seen it until I upgraded to plotly 2.x (I have tried 2.0.1 and 2.0.2).

@rgbkrk
Copy link
Contributor

rgbkrk commented Feb 25, 2017

One thing to note - nbformat has to be upgraded for the Python your notebook server is running with (and server restarted). /cc @minrk

@malindho
Copy link

I'm running this locally on my mac, and am still seeing the issue after updating nbformat. Any ideas?

@rmnvncnt
Copy link

@malindho You should update to nbformat 4.3.0

@bermanmaxim
Copy link

For some reason conda update nbformat was not enough for me in my conda installation. However pip did the trick.

@antvig
Copy link

antvig commented Oct 24, 2017

Hi I updated nbformat to 4.3.0 and it still raises the same "validation failed" issue...

@antvig
Copy link

antvig commented Oct 24, 2017

[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': {}}

@bojiang
Copy link

bojiang commented Dec 4, 2017

I've updated nbformat (to 4.2.0) and am still seeing this issue.

@malindho @antvig
I upgrade my jupyter at the same time and the problem is solved:
pip install --upgrade jupyter

@alubbock
Copy link

alubbock commented Feb 13, 2020

@chriddyp I'm still seeing this issue, even with up-to-date packages and a clean installation. Steps to reproduce with conda:

# 1. Create environment
conda create -n plotly_test python=3.8 plotly numpy notebook
conda activate plotly_test

# 2. Download the Jupyter notebook from the first post in this thread:
# https://gist.githubusercontent.com/empet/cf922d7c7f4269d6f63432ec67a5d020/raw/79e1fb7d16b372cb7156a9c423bede0023127af0/iplot-bug

# 3. Start Jupyter Notebook, open the notebook, clear and run all,
# then try to save it. A validation error appears.
jupyter notebook

Output of pip freeze:

appnope==0.1.0
attrs==19.3.0
backcall==0.1.0
bleach==3.1.0
certifi==2019.11.28
decorator==4.4.1
defusedxml==0.6.0
entrypoints==0.3
importlib-metadata==1.5.0
ipykernel==5.1.4
ipython==7.12.0
ipython-genutils==0.2.0
jedi==0.16.0
Jinja2==2.11.1
jsonschema==3.2.0
jupyter-client==5.3.4
jupyter-core==4.6.1
MarkupSafe==1.1.1
mistune==0.8.4
mkl-fft==1.0.15
mkl-service==2.3.0
nbconvert==5.6.1
nbformat==5.0.4
notebook==6.0.3
numpy==1.18.1
pandocfilters==1.4.2
parso==0.6.1
pexpect==4.8.0
pickleshare==0.7.5
plotly==4.5.0
prometheus-client==0.7.1
prompt-toolkit==3.0.3
ptyprocess==0.6.0
Pygments==2.5.2
pyrsistent==0.15.7
python-dateutil==2.8.1
pyzmq==18.1.1
retrying==1.3.3
Send2Trash==1.5.0
six==1.14.0
terminado==0.8.3
testpath==0.4.4
tornado==6.0.3
traitlets==4.3.3
wcwidth==0.1.8
webencodings==0.5.1
zipp==2.2.0

Update 2018-02-14:
Using nbformat 4.x, rather than 5.x, seems to resolve the issue. Should this be registered as a bug with nbformat, or is this a plotly issue?

@WittmannF
Copy link

Although this is from many years ago, I am having the same issue here. Maybe it is a problem when using MacOS, as it is my case as well.

@claes-mayne
Copy link

Although this is from many years ago, I am having the same issue here. Maybe it is a problem when using MacOS, as it is my case as well.

I have the same problem.

nbformat==5.0.4
plotly==4.6.0

@adizhol
Copy link

adizhol commented Dec 17, 2020

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests