Open seblabbe opened 3 years ago
Let the following be the content of the file a.ipynb
:
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1+1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "SageMath 8.3.beta4",
"language": "",
"name": "sagemath"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.15"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Also it seems that I have pandoc installed:
sage: from sage.doctest.external import has_pandoc
sage: has_pandoc()
FeatureTestResult('Pandoc', True)
sage: bool(_)
True
although:
$ sage --optional | grep pandoc
pandoc..................................none (not_installed)
pandoc_attributes.......................8bc82f6d (8bc82f6d)
Then, the command
$ sage --ipynb2rst a.ipynb
gives
[NbConvertApp] WARNING | Config option `template_path` not recognized by `RSTExporter`. Did you mean one of: `extra_template_paths, template_name, template_paths`?
[NbConvertApp] Converting notebook a.ipynb to rst
Traceback (most recent call last):
File "/home/slabbe/GitBox/sage/local/bin/jupyter-nbconvert", line 8, in <module>
sys.exit(main())
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/jupyter_core/application.py", line 254, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
app.start()
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 346, in start
self.convert_notebooks()
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 518, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 483, in convert_single_notebook
output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 412, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 181, in from_filename
return self.from_file(f, resources=resources, **kw)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 199, in from_file
return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 390, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 149, in template
self._template_cached = self._load_template()
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 360, in _load_template
return self.environment.get_template(template_file)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/jinja2/environment.py", line 883, in get_template
return self._load_template(name, self.make_globals(globals))
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/jinja2/environment.py", line 857, in _load_template
template = self.loader.load(self, name, globals)
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/jinja2/loaders.py", line 429, in load
raise TemplateNotFound(name)
jinja2.exceptions.TemplateNotFound: rst_sage.tpl
Usage:
sage -ipynb2rst <source> [<destination>]
Generates reStructuredText source (.rst) from IPython worksheet (.ipynb).
If the destination is not specified, the reStructuredText source is written in
the standard output.
Examples:
sage -ipynb2rst file.ipynb file.rst
sage -ipynb2rst file.ipynb
Options:
-h, --help show this help message and exit
Traceback (most recent call last):
File "/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/sage/ext_data/nbconvert/postprocess.py", line 20, in <module>
with open(file_name, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'a.rst'
Salut Thierry, it seems ipynb2rst
is currently broken... Can you take a look?
Author: Thierry Monteil
This is not a pandoc issue. I see two problems due to changes in nbconvert
:
Let me fix that.
Commit: e50afe6
I forgot to package jupyter_contrib_nbextensions
that is a new dependency of nbconvert
. At least, if you need it right now, you can just do sage -pip install jupyter_contrib_nbextensions
and the current branch should work.
I don't see this dependency in https://github.com/jupyter/nbconvert/blob/main/setup.py, can you clarify?
Dependencies: #32174
Bonne année Thierry! Ce serait pas mal de régler ce problème pour 9.5. Est-ce tu as une idée comment corriger ce problème et ajouter le package manquant ou je ne sais trop? J'agirai comme reviewer.
New commits:
95efa55 | Merge #32174 |
ad47d1f | Revert "src/sage/tests/cmdline.py: Mark a doctest # known bug #32697" |
Set milestone to sage-9.6 after Sage 9.5 release.
On Ubuntu 18.04 with 9.5.beta3, the command
gives
Depends on #32174
CC: @sagetrac-tmonteil
Component: packages: optional
Author: Thierry Monteil
Branch/Commit: u/mkoeppe/sage___ipynb2rst_is_broken_due_to_changes_in_nbconvert @
ad47d1f
Issue created by migration from https://trac.sagemath.org/ticket/32697