R notebook not executing with `jupyter nbconvert --execute`

131 views
Skip to first unread message

Jonathan Taylor

unread,
Sep 27, 2016, 3:58:16 PM9/27/16
to Project Jupyter
I am trying to execute and save a notebook with the "ir" kernel but am getting an error. It runs find under `jupyter notebook` Here is a notebook that fails


~/git-repos/datascience_101 (master) $ jupyter nbconvert --execute --to notebook --allow-errors modules/intro/intro-lab01.ipynb

[NbConvertApp] Converting notebook modules/intro/intro-lab01.ipynb to notebook

[NbConvertApp] Executing notebook with kernel: ir

Traceback (most recent call last):

  File "/Users/jonathantaylor/anaconda/bin/jupyter-nbconvert", line 6, in <module>

    main()

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance

    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/traitlets/config/application.py", line 589, in launch_instance

    app.start()

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 289, in start

    self.convert_notebooks()

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 412, in convert_notebooks

    self.convert_single_notebook(notebook_filename)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 383, in convert_single_notebook

    output, resources = self.export_single_notebook(notebook_filename, resources)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 335, in export_single_notebook

    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 165, in from_filename

    return self.from_notebook_node(nbformat.read(f, as_version=4), resources=resources, **kw)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/exporters/notebook.py", line 26, in from_notebook_node

    nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 130, in from_notebook_node

    nb_copy, resources = self._preprocess(nb_copy, resources)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 302, in _preprocess

    nbc, resc = preprocessor(nbc, resc)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__

    return self.preprocess(nb,resources)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/preprocessors/execute.py", line 83, in preprocess

    nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/preprocessors/base.py", line 70, in preprocess

    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/preprocessors/execute.py", line 97, in preprocess_cell

    outputs = self.run_cell(cell)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbconvert/preprocessors/execute.py", line 183, in run_cell

    out = output_from_msg(msg)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbformat/v4/nbbase.py", line 77, in output_from_msg

    data=content['data'],

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbformat/v4/nbbase.py", line 42, in new_output

    validate(output, output_type)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbformat/v4/nbbase.py", line 23, in validate

    return validate(node, ref=ref, version=nbformat)

  File "/Users/jonathantaylor/anaconda/lib/python2.7/site-packages/nbformat/validator.py", line 156, in validate

    raise better_validation_error(e, version, version_minor)

jsonschema.exceptions.ValidationError: None is not valid under any of the given schemas


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

    {u'oneOf': [{u'type': u'string'},

                {u'items': {u'type': u'string'}, u'type': u'array'}]}


On instance[u'data'][u'text/latex']:

    None



~/git-repos/datascience_101 (master) $ jupyter nbconvert --execute --to notebook --allow-errors modules/intro/intro-lab02.ipynb

[NbConvertApp] Converting notebook modules/intro/intro-lab02.ipynb to notebook

[NbConvertApp] Executing notebook with kernel: ir

[NbConvertApp] Writing 623234 bytes to intro-lab02.nbconvert.ipynb

~/git-repos/datascience_101 (master)


(The second one has some data files I could include if necessary).

Jonathan Taylor

unread,
Sep 27, 2016, 4:15:46 PM9/27/16
to Project Jupyter
I should probably add that these notebooks were generated by subclassing notedown's MarkdownReader and manually inserting metadata to set the kernel to "ir".

That said, `jupyter notebook` works fine on these notebooks.

Thomas Kluyver

unread,
Sep 28, 2016, 8:00:09 AM9/28/16
to Project Jupyter
Hi Jonathan,

It looks like somewhere in the json it has an output with:

'text/latex': null

I don't know exactly how it occurred, but if you can find that, remove that key-value pair and it should be OK.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/6361d0d9-374b-4550-9080-60ba40be7987%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jonathan Taylor

unread,
Sep 30, 2016, 5:52:03 PM9/30/16
to Project Jupyter
Thanks for the reply. It seems like a cell like this would be the problem? I didn't find exactly  ''' "text/latex": null ''' in the file, though.

    {
     "data": {
      "text/html": [],
      "text/latex": [],
      "text/markdown": [],
      "text/plain": [
       "logical(0)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },

I guess I will try to see how that got inserted in the notebook from (subclassed) notedown...
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

luck

unread,
Oct 18, 2016, 8:47:02 AM10/18/16
to Project Jupyter
Hi Jonathan,

did you find a solution to your problem? If yes, what was your solution.
I seem to have the same problem when trying to use RunNotebook to include a R notebook via sphinx.  
I have 2 R notebooks and only one has this problem.

Luc
Reply all
Reply to author
Forward
0 new messages