Skip to content
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

KeyError (None, None) for v.nbformat_schema #571

Closed
hongshanli23 opened this issue Jan 21, 2021 · 3 comments
Closed

KeyError (None, None) for v.nbformat_schema #571

hongshanli23 opened this issue Jan 21, 2021 · 3 comments

Comments

@hongshanli23
Copy link

My nobebook test_papermill.ipynb looks like

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "parameters"
    ]
   },
   "outputs": [],
   "source": [
    "alpha = 0.1\n",
    "beta = 0.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(alpha, beta)"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Environment (conda_pytorch_p36)",
   "language": "python",
   "name": "conda_pytorch_p36"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}

The first cell has a tag parameters. When I execute the following

papermill --help-notebook test_papermill.ipynb

I got the following error

Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/pytorch_p36/bin/papermill", line 8, in
sys.exit(papermill())
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/papermill/cli.py", line 237, in papermill
sys.exit(display_notebook_help(click_ctx, notebook_path, parameters_final))
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/papermill/inspection.py", line 67, in display_notebook_help
nb = _open_notebook(notebook_path, parameters)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/papermill/inspection.py", line 19, in _open_notebook
return load_notebook_node(input_path)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/papermill/iorw.py", line 411, in load_notebook_node
nb_upgraded = nbformat.v4.upgrade(nb)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nbformat/v4/convert.py", line 39, in upgrade
_warn_if_invalid(nb, from_version)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nbformat/v4/convert.py", line 21, in _warn_if_invalid
validate(nb, version=version)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nbformat/validator.py", line 276, in validate
relax_add_props=relax_add_props):
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nbformat/validator.py", line 298, in iter_validate
validator = get_validator(version, version_minor, relax_add_props=relax_add_props)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nbformat/validator.py", line 69, in get_validator
schema_json = _get_schema_json(v, version=version, version_minor=version_minor)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nbformat/validator.py", line 103, in _get_schema_json
schema_path = os.path.join(os.path.dirname(v.file), v.nbformat_schema[(None, None)])
KeyError: (None, None)

@cskaandorp
Copy link

cskaandorp commented Jan 22, 2021

I had the same problem! Upgrading the nbformat package solved the issue for me:

pip install nbformat --upgrade

@MSeal
Copy link
Member

MSeal commented Jan 22, 2021

Ahh yes. I think we need to require the latest nbformat in papermill now. I'll add a min version to our requirements section.

@MSeal
Copy link
Member

MSeal commented Jan 22, 2021

2.3.1 has the appropriate version requirement specified to avoid this error now

@MSeal MSeal closed this as completed Jan 22, 2021
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

3 participants