jupyter/nbconvert

problem with --to html and --to pdf

Sirin24 opened this issue · 0 comments

Hello, I want to be able to have an html file or pdf file from .ipynb or .py file. I use slurm on a server

what I did :
I created .ipynb file in colab and in visual studio ( i tried both)

then i downloaded such files and uploaded them to the server

Then in a conda environment ( jupyter nbconvert --to notebook --execute Untitled17.ipynb ) worked for me

while ( jupyter nbconvert --to html --execute Untitled17.ipynb ) did not work

the error is :

[NbConvertApp] Converting notebook Untitled17.ipynb to html
[NbConvertApp] Executing notebook with kernel: python3
Traceback (most recent call last):
  File "/user/conda-environments/py-env/bin/jupyter-nbconvert", line 11, in <module>
    sys.exit(main())
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/jupyter_core/application.py", line 270, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/traitlets/config/application.py", line 837, in launch_instance
    app.start()
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 350, in start
    self.convert_notebooks()
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 524, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 489, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 418, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 181, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/user/conda-environments/py-env/lib/python3.8/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 "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/exporters/html.py", line 119, in from_notebook_node
    return super().from_notebook_node(nb, resources, **kw)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line 384, in from_notebook_node
    output = self.template.render(nb=nb_copy, resources=resources)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line 148, in template
    self._template_cached = self._load_template()
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line 355, in _load_template
    return self.environment.get_template(template_file)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/jinja2/environment.py", line 883, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/jinja2/environment.py", line 857, in _load_template
    template = self.loader.load(self, name, globals)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/jinja2/loaders.py", line 426, in load
    return loader.load(environment, name, globals)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/jinja2/loaders.py", line 127, in load
    code = environment.compile(source, name, filename)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/jinja2/environment.py", line 638, in compile
    self.handle_exception(source=source_hint)
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/user/conda-environments/py-env/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/home/.local/share/jupyter/nbconvert/templates/lab/index.html.j2", line 13, in template
    {% set nb_title = nb.metadata.get('title', resources['metadata']['name']) | escape_html_keep_quotes %}
jinja2.exceptions.TemplateAssertionError: no filter named 'escape_html_keep_quotes'

conda list | grep ^jupyter
jupyter 1.0.0 pypi_0 pypi
jupyter-console 6.2.0 pypi_0 pypi
jupyter_client 6.1.7 py_0 anaconda
jupyter_core 4.6.3 py38h32f6830_2 conda-forge
jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge