Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notebook Validation Failed

While running jupyter notebook I get this error. Any idea?

An invalid notebook may not function properly. The validation error was:
Notebook validation failed: ['outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend'] has non-unique elements:
[
 "outputPrepend",
 "outputPrepend",
 "outputPrepend",
 "outputPrepend",
 "outputPrepend"
]
like image 300
Subir Verma Avatar asked Apr 27 '20 07:04

Subir Verma


1 Answers

I had the same issue. And I have solved the issue using Jupiter logs. My Jupiter's log was

(venv) > jupyter notebook     
[I 18:12:33.188 NotebookApp] Serving notebooks from local directory: /home/engmrgh/Projects/
[I 18:12:33.188 NotebookApp] The Jupyter Notebook is running at:
[I 18:12:33.188 NotebookApp] http://localhost:8888/?token=3a9a191653274c25f7cf09049d87b8588fefbda0ec48fcd4
[I 18:12:33.189 NotebookApp]  or http://127.0.0.1:8888/?token=3a9a191653274c25f7cf09049d87b8588fefbda0ec48fcd4
[I 18:12:33.189 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:12:33.255 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/engmrgh/.local/share/jupyter/runtime/nbserver-6233-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=3a9a191653274c25f7cf09049d87b8588fefbda0ec48fcd4
     or http://127.0.0.1:8888/?token=3a9a191653274c25f7cf09049d87b8588fefbda0ec48fcd4
[E 18:12:42.647 NotebookApp] Notebook JSON is invalid: ['outputPrepend', 'outputPrepend'] has non-unique elements
    
    Failed validating 'uniqueItems' in code_cell['properties']['metadata']['properties']['tags']:
    
    On instance['cells'][38]['metadata']['tags']:
    ['outputPrepend', 'outputPrepend']
[W 18:12:42.707 NotebookApp] Notebook LDA.ipynb is not trusted
[I 18:12:44.126 NotebookApp] Kernel started: 28c189d6-a445-417a-9577-88fadd4464ea
[I 18:24:35.296 NotebookApp] Saving file at /LDA.ipynb
[W 18:24:35.296 NotebookApp] Notebook LDA.ipynb is not trusted

The Important part of the above log is:

On instance['cells'][38]['metadata']['tags']: ['outputPrepend', 'outputPrepend']

Basically it says that there is something wrong in the cell 39 (index starts from 0, so 38+1) of the notebook. When I enabled the metadata and headed over to cell 39, by clicking on the metadata button appeared in the cell I saw that contents of metadata are the error shown for validation, deleting the contents solved the issue.

NOTE: To enable the metadata of each cell, follow View > Cell Toolbar > Edit Metadata as shown in the image below.

enter image description here

like image 191
eng.mrgh Avatar answered Nov 18 '22 08:11

eng.mrgh