jupyter / nbformat

Reference implementation of the Jupyter Notebook format
http://nbformat.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
267 stars 151 forks source link

Notebook validation failed - notebook with widget- nbformat 5.0.4 #166

Open mzarei opened 4 years ago

mzarei commented 4 years ago

I am getting following error over and over and have no idea what causes it! Notebook validation failed: {'model_id': '59d3b150e8eb4e44b6c0ce0030dfc2b7', 'version_major': 2, 'version_minor': 0} is not valid under any of the given schemas: { "model_id": "59d3b150e8eb4e44b6c0ce0030dfc2b7", "version_major": 2, "version_minor": 0 }

I see following details when I run this command: jupyter-jupyadmin@labs:~$ conda list

packages in environment at /opt/tljh/user: Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 0_gnu conda-forge alembic 1.3.3 pypi_0 pypi asn1crypto 1.3.0 py36_0 conda-forge async-generator 1.10 pypi_0 pypi attrs 19.3.0 pypi_0 pypi backcall 0.1.0 pypi_0 pypi bleach 3.1.0 pypi_0 pypi boost-cpp 1.70.0 h8e57a91_2 conda-forge bzip2 1.0.8 h516909a_2 conda-forge ca-certificates 2019.11.28 hecc5488_0 conda-forge cairo 1.16.0 hfb77d84_1002 conda-forge certifi 2019.11.28 py36_0 conda-forge certipy 0.1.3 pypi_0 pypi cffi 1.13.2 py36h8022711_0 conda-forge cfitsio 3.470 hb60a0a2_2 conda-forge chardet 3.0.4 py36_1003 conda-forge conda 4.8.2 py36_0 conda-forge conda-env 2.6.0 h36134e3_1 conda-package-handling 1.6.0 py36h516909a_1 conda-forge cryptography 2.8 py36h72c5cf5_1 conda-forge curl 7.65.3 hf8cf82a_0 conda-forge decorator 4.4.1 pypi_0 pypi defusedxml 0.6.0 pypi_0 pypi entrypoints 0.3 pypi_0 pypi expat 2.2.9 he1b5a44_2 conda-forge fontconfig 2.13.1 h86ecdb6_1001 conda-forge freetype 2.10.0 he983fc9_1 conda-forge freexl 1.0.5 h14c3975_1002 conda-forge gdal 3.0.4 py36hbb6b9fb_0 conda-forge geos 3.8.0 he1b5a44_0 conda-forge geotiff 1.5.1 h38872f0_8 conda-forge gettext 0.19.8.1 hc5be6a0_1002 conda-forge giflib 5.2.1 h516909a_1 conda-forge glib 2.58.3 py36h6f030ca_1002 conda-forge hdf4 4.2.13 hf30be14_1003 conda-forge hdf5 1.10.5 nompi_h3c11f04_1104 conda-forge icu 64.2 he1b5a44_1 conda-forge idna 2.8 py36_1000 conda-forge importlib-metadata 1.5.0 pypi_0 pypi ipykernel 5.1.4 pypi_0 pypi ipython 7.11.1 pypi_0 pypi ipython-genutils 0.2.0 pypi_0 pypi ipywidgets 7.4.2 pypi_0 pypi jedi 0.16.0 pypi_0 pypi jinja2 2.11.1 pypi_0 pypi jpeg 9c h14c3975_1001 conda-forge json-c 0.13.1 h14c3975_1001 conda-forge jsonschema 3.2.0 pypi_0 pypi jupyter-client 5.3.4 pypi_0 pypi jupyter-core 4.6.1 pypi_0 pypi jupyterhub 1.0.0 pypi_0 pypi jupyterlab 0.35.4 pypi_0 pypi jupyterlab-server 0.2.0 pypi_0 pypi kealib 1.4.10 h58c409b_1005 conda-forge krb5 1.16.4 h2fd8d38_0 conda-forge libblas 3.8.0 14_openblas conda-forge libcblas 3.8.0 14_openblas conda-forge libcurl 7.65.3 hda55be3_0 conda-forge libdap4 3.20.4 hd3bb157_0 conda-forge libedit 3.1.20170329 h6b74fdf_2 libffi 3.2.1 hfc679d8_5 conda-forge libgcc-ng 9.2.0 h24d8f2e_2 conda-forge libgdal 3.0.4 h20022a4_0 conda-forge libgfortran-ng 7.3.0 hdf63c60_4 conda-forge libgomp 9.2.0 h24d8f2e_2 conda-forge libiconv 1.15 h516909a_1005 conda-forge libkml 1.3.0 h4fcabce_1010 conda-forge liblapack 3.8.0 14_openblas conda-forge libnetcdf 4.7.3 nompi_h9f9fd6a_101 conda-forge libopenblas 0.3.7 h5ec1e0e_6 conda-forge libpng 1.6.37 hed695b0_0 conda-forge libpq 12.1 hd9ab2ff_0 conda-forge libspatialite 4.3.0a ha48a99a_1034 conda-forge libssh2 1.8.2 h22169c7_2 conda-forge libstdcxx-ng 9.2.0 hdf63c60_2 conda-forge libtiff 4.1.0 hc3755c2_3 conda-forge libuuid 2.32.1 h14c3975_1000 conda-forge libwebp 1.0.2 h56121f0_5 conda-forge libxcb 1.13 h14c3975_1002 conda-forge libxml2 2.9.10 hee79883_0 conda-forge lz4-c 1.8.3 he1b5a44_1001 conda-forge mako 1.1.1 pypi_0 pypi markupsafe 1.1.1 pypi_0 pypi mistune 0.8.4 pypi_0 pypi nbconvert 5.6.1 pypi_0 pypi nbformat 5.0.4 pypi_0 pypi nbgitpuller 0.6.1 pypi_0 pypi nbresuse 0.3.0 pypi_0 pypi nbzip 0.1.0 pypi_0 pypi ncurses 6.1 hfc679d8_2 conda-forge notebook 5.7.8 pypi_0 pypi nteract-on-jupyter 2.0.7 pypi_0 pypi numpy 1.17.5 py36h95a1406_0 conda-forge oauthlib 3.1.0 pypi_0 pypi openjpeg 2.3.1 h981e76c_3 conda-forge openssl 1.1.1d h516909a_0 conda-forge pamela 1.0.0 pypi_0 pypi pandocfilters 1.4.2 pypi_0 pypi parso 0.6.0 pypi_0 pypi pcre 8.43 he1b5a44_0 conda-forge pexpect 4.8.0 pypi_0 pypi pickleshare 0.7.5 pypi_0 pypi pip 20.0.2 py36_1 conda-forge pixman 0.38.0 h516909a_1003 conda-forge poppler 0.67.0 h14e79db_8 conda-forge poppler-data 0.4.9 1 conda-forge postgresql 12.1 hc63931a_0 conda-forge proj 6.3.0 hc80f0dc_0 conda-forge prometheus-client 0.7.1 pypi_0 pypi prompt-toolkit 3.0.3 pypi_0 pypi psutil 5.6.7 pypi_0 pypi pthread-stubs 0.4 h14c3975_1001 conda-forge ptyprocess 0.6.0 pypi_0 pypi pycosat 0.6.3 py36h516909a_1002 conda-forge pycparser 2.19 py36_1 conda-forge pygments 2.5.2 pypi_0 pypi pyopenssl 19.0.0 py36_0 conda-forge pyrsistent 0.15.7 pypi_0 pypi pysocks 1.7.1 py36_0 conda-forge python 3.6.7 h357f687_1006 conda-forge python-dateutil 2.8.1 pypi_0 pypi python-editor 1.0.4 pypi_0 pypi pyzmq 18.1.1 pypi_0 pypi readline 8.0 hf8c457e_0 conda-forge requests 2.22.0 py36_1 conda-forge ruamel_yaml 0.15.80 py36h516909a_1000 conda-forge send2trash 1.5.0 pypi_0 pypi setuptools 45.1.0 py36_0 conda-forge six 1.14.0 py36_0 conda-forge sqlalchemy 1.3.13 pypi_0 pypi sqlite 3.30.1 hcee41ef_0 conda-forge tbb 2018.0.5 h2d50403_0 conda-forge terminado 0.8.3 pypi_0 pypi testpath 0.4.4 pypi_0 pypi tiledb 1.7.0 hcde45ca_2 conda-forge tk 8.6.10 hed695b0_0 conda-forge tornado 5.1.1 pypi_0 pypi tqdm 4.42.0 py_0 conda-forge traitlets 4.3.3 pypi_0 pypi tzcode 2019a h516909a_1002 conda-forge urllib3 1.25.7 py36_0 conda-forge wcwidth 0.1.8 pypi_0 pypi webencodings 0.5.1 pypi_0 pypi wheel 0.34.2 py36_0 conda-forge widgetsnbextension 3.4.2 pypi_0 pypi xerces-c 3.2.2 h8412b87_1004 conda-forge xorg-kbproto 1.0.7 h14c3975_1002 conda-forge xorg-libice 1.0.10 h516909a_0 conda-forge xorg-libsm 1.2.3 h84519dc_1000 conda-forge xorg-libx11 1.6.9 h516909a_0 conda-forge xorg-libxau 1.0.9 h14c3975_0 conda-forge xorg-libxdmcp 1.1.3 h516909a_0 conda-forge xorg-libxext 1.3.4 h516909a_0 conda-forge xorg-libxrender 0.9.10 h516909a_1002 conda-forge xorg-renderproto 0.11.1 h14c3975_1002 conda-forge xorg-xextproto 7.3.0 h14c3975_1002 conda-forge xorg-xproto 7.0.31 h14c3975_1007 conda-forge xz 5.2.4 h14c3975_1001 conda-forge yaml 0.2.2 h516909a_1 conda-forge zipp 2.1.0 pypi_0 pypi zlib 1.2.11 h516909a_1006 conda-forge zstd 1.4.4 h3b9ef0a_1 conda-forge

Also, checking the notebook metadata I see following information:

{
  "anaconda-cloud": {},
  "kernelspec": {
    "name": "python3",
    "display_name": "Python 3",
    "language": "python"
  },
  "language_info": {
    "name": "python",
    "version": "3.6.7",
    "mimetype": "text/x-python",
    "codemirror_mode": {
      "name": "ipython",
      "version": 3
    },
    "pygments_lexer": "ipython3",
    "nbconvert_exporter": "python",
    "file_extension": ".py"
  },
  "widgets": {
    "state": {
      "0fe728eba2e6465c9b452d2eb017fee1": {
        "views": [
          {
            "cell_index": 26
          }
        ]
      },
      "282b6d570ecd448d9ad1c8ac5ebf7b0f": {
        "views": [
          {
            "cell_index": 40
          }
        ]
      }
    },
    "version": "1.2.0"
  }
}
MSeal commented 4 years ago

I believe this is the same issue as #160 with the same resolution path.

mzarei commented 4 years ago

I believe this is the same issue as #160 with the same resolution path.

Actually, I already check that. But unfortunately, I don't understand the solution! I am not able to save the notebook as it shows the error. So, I don't know how to update it's metadata correctly!

So, no idea where I can change these values or check it: "version_major": 2, "version_minor": 0

MSeal commented 4 years ago

If you load the notebook in jupyter lab instead of jupyter classic it should upgrade the file format for you. Otherwise, you can try editing the ipynb notebook with a text editor and changing the version line referenced by hand (this may work, but if there's structural differences your notebook won't load either).

Worse case, install an older version of nbformat, copy the cell contents to a new new notebook, save the new notebook, upgrade nbformat back, and replace the old file with the new one.

mzarei commented 4 years ago

I failed to open the notebook in jupyter lab, as after I installed jupyterlab using the terminal in my jupyter hub, nothing worked! When I run jupyter lab in the jupyter hub terminal it didn't open the browser! I assume because I install the jupyter hub in a different server, but it was trying to load it like as a localhost! The I got error 500 internal server error after installing jupyterlab when I tried to open any notebook. I had to run this command pip3 install --upgrade --user nbconvert to fix things. About jupyter lab, I feel I am making a silly mistake, which I haven't sort out yet!

Anyway, long story short, replacing "nbformat_minor": 1 with "nbformat_minor": 4 manually fixed the issue. Now I don't get the error and I can save the notebook or print it as a pdf.

Thanks :)

DavidJVitale commented 4 years ago

As a short-term workaround, you could downgrade your nbformat to <5 by running the following conda command:

conda install "nbformat <5"

youweiliang commented 4 years ago

@mzarei Changing "nbformat_minor": 1 to"nbformat_minor": 4 resolved the same issue for me. Thanks.

ofekp commented 4 years ago

@youweiliang's answer did the trick for me. To open ipynb file as a text file in VS Code I used this answer from SO.

infontology commented 3 years ago

I did Duplicate from the Home page / notebook list, and the duplicate passed validation, so this solved my issue.

abhimanyu-bitsgoa commented 2 years ago

Hi @MSeal I was facing a similar issue. Updating the notebook nbformat_minor version to 5 fixed it for me.

Can you please explain why this was happening and why this fixes the issue?

Thanks a lot in advance.