Inkscape Error when converting julia notebook to PDF

Hi. I am trying to convert my notebook to PDF. I have installed the Inkscape using anaconda prompt, but I get the following error. Would you please provide me with a simple solution (since I am an economist rather than a Professional Programmer :sweat_smile:). Thanks a lot.

Traceback (most recent call last):
  File "G:\anaconda\lib\site-packages\traitlets\traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'command'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\anaconda\lib\site-packages\traitlets\traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'inkscape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\anaconda\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 67, in _inkscape_default
    rkey = winreg.OpenKey(wr_handle, "SOFTWARE\\Classes\\inkscape.svg\\DefaultIcon")
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\anaconda\Scripts\jupyter-nbconvert-script.py", line 9, in <module>
    sys.exit(main())
  File "G:\anaconda\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "G:\anaconda\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
    app.start()
  File "G:\anaconda\lib\site-packages\nbconvert\nbconvertapp.py", line 338, in start
    self.convert_notebooks()
  File "G:\anaconda\lib\site-packages\nbconvert\nbconvertapp.py", line 508, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "G:\anaconda\lib\site-packages\nbconvert\nbconvertapp.py", line 479, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "G:\anaconda\lib\site-packages\nbconvert\nbconvertapp.py", line 408, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "G:\anaconda\lib\site-packages\nbconvert\exporters\exporter.py", line 179, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "G:\anaconda\lib\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 "G:\anaconda\lib\site-packages\nbconvert\exporters\pdf.py", line 164, in from_notebook_node
    nb, resources=resources, **kw
  File "G:\anaconda\lib\site-packages\nbconvert\exporters\latex.py", line 84, in from_notebook_node
    return super(LatexExporter, self).from_notebook_node(nb, resources, **kw)
  File "G:\anaconda\lib\site-packages\nbconvert\exporters\templateexporter.py", line 299, in from_notebook_node
    nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw)
  File "G:\anaconda\lib\site-packages\nbconvert\exporters\exporter.py", line 139, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
  File "G:\anaconda\lib\site-packages\nbconvert\exporters\exporter.py", line 316, in _preprocess
    nbc, resc = preprocessor(nbc, resc)
  File "G:\anaconda\lib\site-packages\nbconvert\preprocessors\base.py", line 47, in __call__
    return self.preprocess(nb, resources)
  File "G:\anaconda\lib\site-packages\nbconvert\preprocessors\base.py", line 69, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "G:\anaconda\lib\site-packages\nbconvert\preprocessors\convertfigures.py", line 46, in preprocess_cell
    self.from_format, output.data[self.from_format])
  File "G:\anaconda\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 91, in convert_figure
    shell = self.command.format(from_filename=input_filename,
  File "G:\anaconda\lib\site-packages\traitlets\traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "G:\anaconda\lib\site-packages\traitlets\traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "G:\anaconda\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 55, in _command_default
    return self.inkscape + \
  File "G:\anaconda\lib\site-packages\traitlets\traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "G:\anaconda\lib\site-packages\traitlets\traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "G:\anaconda\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 70, in _inkscape_default
    raise FileNotFoundError("Inkscape executable not found")
FileNotFoundError: Inkscape executable

Preformatted text not found

Did you already try these approaches?

Since you suggested you were seeking a simple solution, I’d avoid this one unless you feel brave. I’m mainly putting it here since it is in the vein of the issue and it may help others finding this thread later troubleshoot:
nbconvert 5.6.1 failed with message: "nbconvert failed: Inkscape svg to pdf conversion failed" in Win 10 · Issue #1325 · jupyter/nbconvert · GitHub has some trouble-shooting illustrated here (that first link was found here; however, the posts in response do not seem to be for Windows)

1 Like

Thank You! The first link was quite useful. The previous error is solved.
Now it says: Failed to run “xelatex notebook.tex -quiet” command.

I will be grateful if you also provide the solution for this error.

I’d guess you have an issue like addressed here.
Follow that solution the person on Windows says helped:

“Installing miktex worked perfectly running Anaconda on Windows”

Yes. There was a problem with the latex syntax. It is completely solved now. thanks again.

1 Like