Bug 1830647

Summary: python3-nbconvert package lacks dependency on Inkscape
Product: [Fedora] Fedora Reporter: spilot+redhatbugzilla <spilot+redhatbugzilla>
Component: python-nbconvertAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: mhroncok, nonamedotc, python-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-nbconvert-5.6.0-4.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-14 02:35:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description spilot+redhatbugzilla@mailbox.org 2020-05-03 09:17:38 UTC
Description of problem:
jupyter-nbconvert uses Inkscape when converting an ipynb file to a pdf file. However, dnf does not install the inkscape package when installing the python3-notebook package.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. On a Fedora 32 installation without either inkscape or python3-nbconvert installed, install python3-nbconvert using dnf
2. Execute
jupyter-nbconvert <file> --to pdf
where file is an iypnb file that contains SVG content

Actual results:
The conversion fails because Inkscape cannot be executed

Expected results:
The conversion succeeds using Inkscape

Additional info:
Manually installing Inkscape does not make the conversion work, because the installed version of Inkscape does not know the CLI parameter "--without-gui" that jupyter-nbconvert tries to use.

Comment 1 Miro Hrončok 2020-05-03 09:35:43 UTC
> Manually installing Inkscape does not make the conversion work, because the installed version of Inkscape does not know the CLI parameter "--without-gui" that jupyter-nbconvert tries to use.

This will be a problem. Could you please copy paste the errors as you get them?

Comment 2 spilot+redhatbugzilla@mailbox.org 2020-05-03 09:49:57 UTC
(In reply to Miro Hrončok from comment #1)
> > Manually installing Inkscape does not make the conversion work, because the installed version of Inkscape does not know the CLI parameter "--without-gui" that jupyter-nbconvert tries to use.
> 
> This will be a problem. Could you please copy paste the errors as you get
> them?

Here is the full output:

$ jupyter-nbconvert mynotebook.ipynb --to pdf
[NbConvertApp] Converting notebook mynotebook.ipynb to pdf
Unknown option --without-gui
Traceback (most recent call last):
  File "/usr/bin/jupyter-nbconvert", line 11, in <module>
    load_entry_point('nbconvert==5.6.0', 'console_scripts', 'jupyter-nbconvert')()
  File "/usr/lib/python3.8/site-packages/jupyter_core/application.py", line 268, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 340, in start
    self.convert_notebooks()
  File "/usr/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 510, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/usr/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 481, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "/usr/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 410, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "/usr/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 179, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/usr/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 197, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "/usr/lib/python3.8/site-packages/nbconvert/exporters/pdf.py", line 170, in from_notebook_node
    latex, resources = super(PDFExporter, self).from_notebook_node(
  File "/usr/lib/python3.8/site-packages/nbconvert/exporters/latex.py", line 88, in from_notebook_node
    return super(LatexExporter, self).from_notebook_node(nb, resources, **kw)
  File "/usr/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line 307, in from_notebook_node
    nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw)
  File "/usr/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 139, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
  File "/usr/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 316, in _preprocess
    nbc, resc = preprocessor(nbc, resc)
  File "/usr/lib/python3.8/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
    return self.preprocess(nb, resources)
  File "/usr/lib/python3.8/site-packages/nbconvert/preprocessors/base.py", line 69, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "/usr/lib/python3.8/site-packages/nbconvert/preprocessors/convertfigures.py", line 45, in preprocess_cell
    output.data[self.to_format] = self.convert_figure(
  File "/usr/lib/python3.8/site-packages/nbconvert/preprocessors/svg2pdf.py", line 102, in convert_figure
    raise TypeError("Inkscape svg to pdf conversion failed")
TypeError: Inkscape svg to pdf conversion failed

Comment 4 Miro Hrončok 2020-05-03 22:14:44 UTC
There is a Fedora 32 scratchbuild at https://src.fedoraproject.org/rpms/python-nbconvert/pull-request/8 -> https://koji.fedoraproject.org/koji/taskinfo?taskID=44067966 -> https://kojipkgs.fedoraproject.org/work/tasks/7969/44067969/python3-nbconvert-5.6.0-4.fc32.noarch.rpm

Could you please verify it fixes the problem? Alternatively, please attach the mynotebook.ipynb file here and I can test it myself.

Comment 5 spilot+redhatbugzilla@mailbox.org 2020-05-04 15:09:47 UTC
Thank you very much for fixing this so fast. Conversion works for me with the rpm you provided.

However, jupyter-nbconvert threw further errors that I could fix by installing the following packages:

texlive-ulem
texlive-titling
texlive-adjustbox
texlive-tcolorbox
pandoc

While the errors that appear when Inkscape or Pandoc are not installed are relatively straightforward to understand (it basically says "Pandoc not installed"),
if I did not know LaTeX I would certainly not have been able to fix the tex-related errors.
I already had a pretty long list of texlive packages installed, so I assume that even more of them are required for jupyter-nbconvert to work.

Comment 6 Miro Hrončok 2020-05-04 15:32:54 UTC
We might want to add recommends for those, but I don't want nbconvert to depend on tex.

Comment 7 Fedora Update System 2020-05-05 00:58:26 UTC
FEDORA-2020-93c50e56a1 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-93c50e56a1

Comment 8 Fedora Update System 2020-05-06 02:23:09 UTC
FEDORA-2020-93c50e56a1 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-93c50e56a1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-93c50e56a1

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2020-05-14 02:35:23 UTC
FEDORA-2020-93c50e56a1 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.