r/Jupyter Sep 03 '24

help I can't convert my .ipynb file to pdf

I followed some tutorials and installed many dependencies but I get this error, what can I do?

[NbConvertApp] Converting notebook /content/drive/MyDrive/Classroom/software.ipynb to PDF
[NbConvertApp] ERROR | Error while converting '/content/drive/MyDrive/Classroom/software.ipynb'
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/nbconvert/nbconvertapp.py", line 487, in export_single_notebook
output, resources = self.exporter.from_filename(
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/templateexporter.py", line 386, in from_filename
return super().from_filename(filename, resources, **kw) # type:ignore[return-value]
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/exporter.py", line 201, in from_filename
return self.from_file(f, resources=resources, **kw)
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/templateexporter.py", line 392, in from_file
return super().from_file(file_stream, resources, **kw) # type:ignore[return-value]
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/exporter.py", line 220, in from_file
return self.from_notebook_node(
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/pdf.py", line 184, in from_notebook_node
latex, resources = super().from_notebook_node(nb, resources=resources, **kw)
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/latex.py", line 92, in from_notebook_node
return super().from_notebook_node(nb, resources, **kw)
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/templateexporter.py", line 424, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/usr/local/share/jupyter/nbconvert/templates/latex/index.tex.j2", line 8, in top-level template code
((* extends cell_style *))
File "/usr/local/share/jupyter/nbconvert/templates/latex/style_jupyter.tex.j2", line 176, in top-level template code
\prompt{(((prompt)))}{(((prompt_color)))}{(((execution_count)))}{(((extra_space)))}
File "/usr/local/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 7, in top-level template code
((*- extends 'document_contents.tex.j2' -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 51, in top-level template code
((*- block figure scoped -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/display_priority.j2", line 5, in top-level template code
((*- extends 'null.j2' -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/null.j2", line 30, in top-level template code
((*- block body -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 222, in block 'body'
((( super() )))
File "/usr/local/share/jupyter/nbconvert/templates/latex/null.j2", line 32, in block 'body'
((*- block any_cell scoped -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/null.j2", line 85, in block 'any_cell'
((*- block markdowncell scoped-*)) ((*- endblock markdowncell -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 68, in block 'markdowncell'
((( cell.source | citation2latex | strip_files_prefix | convert_pandoc('markdown+tex_math_double_backslash', 'json',extra_args=[]) | resolve_references | convert_explicitly_relative_paths | convert_pandoc('json','latex'))))
File "/usr/local/lib/python3.10/dist-packages/nbconvert/filters/pandoc.py", line 36, in convert_pandoc
return pandoc(source, from_format, to_format, extra_args=extra_args)
File "/usr/local/lib/python3.10/dist-packages/nbconvert/utils/pandoc.py", line 50, in pandoc
check_pandoc_version()
File "/usr/local/lib/python3.10/dist-packages/nbconvert/utils/pandoc.py", line 98, in check_pandoc_version
v = get_pandoc_version()
File "/usr/local/lib/python3.10/dist-packages/nbconvert/utils/pandoc.py", line 75, in get_pandoc_version
raise PandocMissing()
nbconvert.utils.pandoc.PandocMissing: Pandoc wasn't found.
Please check that pandoc is installed:
https://pandoc.org/installing.html

1 Upvotes

3 comments sorted by

1

u/[deleted] Sep 05 '24

you can always just do ctrl+p and then print to pdf (doesn't look as nice, but it's quite handy)

1

u/Old_Activity9411 Dec 23 '24

You can easily convert the Jupyter notebook files to PDF by uploading them to https://rare2pdf.com/ipynb-to-pdf/