Notebook validation failed: Additional properties are not allowed ('id' was unexpected):

Question:

Getting below validation error on opening my notebook :

{
"metadata": {
"trusted": true
},
"id": "comparative-import",
"cell_type": "code",
"source": "import numpy as npnimport pandas as pdnimport matplotlib.pyplot as pltnimport seaborn as snsnimport nltknimport renimport gensim nfrom gensim.utils import simple_preprocessnfrom gensim.models.word2vec import Word2Vecnfrom nltk.stem.porter import PorterStemmernfrom nltk.corpus import stopwordsnfrom sklearn.decomposition import PCA,TruncatedSVDnfrom sklearn.manifold import TSNEnfrom sklearn.model_selection import train_test_splitnfrom sklearn.linear_model import LogisticRegressionnfrom wordcloud import WordCloud, STOPWORDS, ImageColorGeneratorn",
"execution_count": 10,
"outputs": []
}

Asked By: Lakshmi R

||

Answers:

Your notebook is just a bunch of import you can easily recreate it for this time I did it for you :

{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Untitled5.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "metadata": {
        "id": "CRAF2wibMCRq"
      },
      "source": [
        "import numpy as np n",
        "import pandas as pdn",
        "import matplotlib.pyplot as pltn",
        "import seaborn as snsn",
        "import nltkn",
        "import ren",
        "import gensim n",
        "from gensim.utils import simple_preprocessn",
        "from gensim.models.word2vec import Word2Vecn",
        "from nltk.stem.porter import PorterStemmern",
        "from nltk.corpus import stopwordsn",
        "from sklearn.decomposition import PCA,TruncatedSVDn",
        "from sklearn.manifold import TSNEn",
        "from sklearn.model_selection import train_test_splitn",
        "from sklearn.linear_model import LogisticRegression n",
        "from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator"
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}
Answered By: Abdarahmane Traoré

I worked around the above issue by copying the contents of the cell instead of the entire cell (which copies also metadata).

Caution: this does not scale well for large notebooks (every cell has to be handled individually).

Answered By: Lakshmi R

Try clear the output of all cells of your Jupyter Notebook.
In Jupyter Notebook, Goto: cell>All Output>Clear

Answered By: iqbal

id is simply not known for notebooks with nbformat below version 4.5.

You can open the notebook file in a text editor and increase the version.

In my case

 "nbformat": 4,
 "nbformat_minor": 4

becomes

 "nbformat": 4,
 "nbformat_minor": 5

For more details https://www.pythonfixing.com/2021/12/fixed-notebook-validation-failed-jupyter.html

Answered By: Franz Knülle
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.