I have been able to use nbconvert in the past, but it isn’t working now. I suspect it is because of my graphs. This is the error that I get:
[NbConvertApp] Converting notebook mlp-week02.ipynb to pdf
Traceback (most recent call last):
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 535, 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 "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 535, in get
value = obj._trait_values[self.name]
KeyError: 'inkscape_version'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 535, 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 "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 101, 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 "c:\users\s1612415\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\s1612415\AppData\Local\Programs\Python\Python39\Scripts\jupyter-nbconvert.EXE\__main__.py", line 7, in <module>
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\jupyter_core\application.py", line 254, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\config\application.py", line 845, in launch_instance
app.start()
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\nbconvertapp.py", line 350, in start
self.convert_notebooks()
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\nbconvertapp.py", line 524, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\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 "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\nbconvertapp.py", line 418, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\exporters\exporter.py", line 181, in from_filename
return self.from_file(f, resources=resources, **kw)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\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 "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\exporters\pdf.py", line 168, in from_notebook_node
latex, resources = super().from_notebook_node(
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\exporters\latex.py", line 77, in from_notebook_node
return super().from_notebook_node(nb, resources, **kw)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\exporters\templateexporter.py", line 369, in from_notebook_node
nb_copy, resources = super().from_notebook_node(nb, resources, **kw)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\exporters\exporter.py", line 143, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\exporters\exporter.py", line 318, in _preprocess
nbc, resc = preprocessor(nbc, resc)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\preprocessors\base.py", line 47, in __call__
return self.preprocess(nb, resources)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\preprocessors\base.py", line 69, in preprocess
nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\preprocessors\convertfigures.py", line 45, in preprocess_cell
output.data[self.to_format] = self.convert_figure(
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 125, in convert_figure
shell = self.command.format(from_filename=input_filename,
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 575, in __get__
return self.get(obj, cls)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 538, in get
default = obj.trait_defaults(self.name)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 1578, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 975, in __call__
return self.func(*args, **kwargs)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 77, in _command_default
major_verison = self.inkscape_version.split('.')[0]
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 575, in __get__
return self.get(obj, cls)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 538, in get
default = obj.trait_defaults(self.name)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 1578, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 975, in __call__
return self.func(*args, **kwargs)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 57, in _inkscape_version_default
p = subprocess.Popen([self.inkscape, '--version'],
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 575, in __get__
return self.get(obj, cls)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 538, in get
default = obj.trait_defaults(self.name)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 1578, in trait_defaults
return self._get_trait_default_generator(names[0])(self)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\traitlets\traitlets.py", line 975, in __call__
return self.func(*args, **kwargs)
File "c:\users\s1612415\appdata\local\programs\python\python39\lib\site-packages\nbconvert\preprocessors\svg2pdf.py", line 104, in _inkscape_default
raise FileNotFoundError("Inkscape executable not found")
FileNotFoundError: Inkscape executable not found
I have installed Inkscape and added the inkscape.exe file to PATH (was I supposed to?), but it still doesn’t work. Any advice?