Ipywidgets: Notebook validation failed

Created on 21 Apr 2017  路  8Comments  路  Source: jupyter-widgets/ipywidgets

I am using jupyter 1.0.0 and ipywidgets 6.0.0 on Python3 and when I try to save my notebook after calling the display() function from IPython.display I get the following message:

Notebook validation failed: {'model_id': '211cc089c9134af79f0a8ccff7244ae8'} is not valid under any of the given schemas:
{
"model_id": "211cc089c9134af79f0a8ccff7244ae8"
}

Example code that gives the error:
from ipywidgets import FloatProgress
from IPython.display import display
a = FloatProgress(value=7.5,min=0,max=10.0)
display(a)
If I remove the call display(a) and save the file it raises no error.

resolved-locked

Most helpful comment

I found a solution to my problem:

From https://github.com/jupyter/nbformat/issues/161#issuecomment-574530127, by updating manually the "nb_format_minor": 1 to "nb_format_minor": 4 the problem disappears.

All 8 comments

This is a bug that occurs with nbformat < 4.2. If you update nbformat, this should go away.

Thanks!

I have nbformat at 5.0.3 and I have this problem... any ideas? Downgrade?

Name: nbformat
Version: 5.0.3
Summary: The Jupyter Notebook format
Home-page: http://jupyter.org

Same issue, with nbformat 5.0.4.
Happens when using widgets, like ipyaggrid.

Can you post a set of instructions, starting from a clean environment, to reproduce the error with nbformat 5.0.x?

I cannot reproduce the error in a clean environment with just ipyaggrid. On the other hand, the behavior is somehow erratic: I have several Notebooks with ipyaggrid working well too.

Those that don't, when opening (if a cell contains the output of a ipyaggrid on save), show the error:

The save operation succeeded, but the notebook does not appear to be valid. The validation error was:

Notebook validation failed: {'model_id': '3f7b24eb3f534f5cb94e5fa15c48d53f', 'version_major': 2, 'version_minor': 0} is not valid under any of the given schemas:
{
"model_id": "3f7b24eb3f534f5cb94e5fa15c48d53f",
"version_major": 2,
"version_minor": 0
}

If I clear the cell's current output, the error disappears.

The server shows the message:

Notebook JSON is invalid: {'version_major': 2, 'version_minor': 0, 'model_id': 'b38fd3f12760491a9b90a5d233f85e6a'} is not valid under any of the given schemas

Failed validating 'oneOf' in display_data['properties']['data']['patternProperties']['^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$']:

On instance['cells'][11]['outputs'][0]['data']['application/vnd.jupyter.widget-view+json']:
{'model_id': 'b38fd3f12760491a9b90a5d233f85e6a',
 'version_major': 2,
 'version_minor': 0}

How can I reproduce the error?

I found a solution to my problem:

From https://github.com/jupyter/nbformat/issues/161#issuecomment-574530127, by updating manually the "nb_format_minor": 1 to "nb_format_minor": 4 the problem disappears.

The problem disappeared for me as well. My jobs have been killed during the weekend (both jupyter notebook and its kernels) and now, reloading the notebook, everything is fine.

Was this page helpful?
0 / 5 - 0 ratings