python — выполнение записных книжек вручную завершается неудачно

Я использую ноутбуки Jupyter с корневым ядром C ++ для создания интерактивной документации.

записные книжки запускаются через мой браузер, но когда я пытаюсь использовать nbconvert для выполнения записных книжек через терминал, выполнение завершается неудачно.
Команда, которую я использую, такова:

jupyter nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute ../notebooks/myfile.ipynb

Ошибка заключается в следующем:

    [NbConvertApp] Converting notebook ../notebooks/myfile.ipynb to notebook
[NbConvertApp] Executing notebook with kernel: root
[NbConvertApp] ERROR | Error while converting '../notebooks/myfile.ipynb'
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/nbconvert/nbconvertapp.py", line 335, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/usr/local/lib/python3.5/site-packages/nbconvert/exporters/exporter.py", line 165, in from_filename
return self.from_notebook_node(nbformat.read(f, as_version=4), resources=resources, **kw)
File "/usr/local/lib/python3.5/site-packages/nbconvert/exporters/notebook.py", line 26, in from_notebook_node
nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)
File "/usr/local/lib/python3.5/site-packages/nbconvert/exporters/exporter.py", line 130, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
File "/usr/local/lib/python3.5/site-packages/nbconvert/exporters/exporter.py", line 302, in _preprocess
nbc, resc = preprocessor(nbc, resc)
File "/usr/local/lib/python3.5/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
return self.preprocess(nb,resources)
File "/usr/local/lib/python3.5/site-packages/nbconvert/preprocessors/execute.py", line 83, in preprocess
nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
File "/usr/local/lib/python3.5/site-packages/nbconvert/preprocessors/base.py", line 70, in preprocess
nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
File "/usr/local/lib/python3.5/site-packages/nbconvert/preprocessors/execute.py", line 112, in preprocess_cell
raise CellExecutionError(msg)
nbconvert.preprocessors.execute.CellExecutionError: An error occurred while executing the following cell:
------------------
sqrt(3.)
------------------

NameError: name 'sqrt' is not defined

Я вижу, что ошибки от Python, даже если мое ядро ​​C ++. Где я должен искать?

РЕДАКТИРОВАТЬ:

После предложения в комментариях. Я сейчас использую эту команду

jupyter nbconvert --ExecutePreprocessor.timeout=600 --ExecutePreprocessor.kernel_name='root' --to notebook --execute ../notebooks/myfile.ipynb

но проблема сохраняется. Во-первых, кажется, что он не распознает атрибут kernel_name, а во-вторых, он все еще не распознает sqrt

[NbConvertApp] WARNING | Config option `kernel_name` not recognized by `ExecutePreprocessor`.
[NbConvertApp] Converting notebook ../notebooks/2-ROOT-Basics.ipynb to notebook
[NbConvertApp] Executing notebook with kernel: root
[NbConvertApp] ERROR | Error while converting '../notebooks/2-ROOT-Basics.ipynb'
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/nbconvert/nbconvertapp.py", line 335, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/usr/local/lib/python3.5/site-packages/nbconvert/exporters/exporter.py", line 165, in from_filename
return self.from_notebook_node(nbformat.read(f, as_version=4), resources=resources, **kw)
File "/usr/local/lib/python3.5/site-packages/nbconvert/exporters/notebook.py", line 26, in from_notebook_node
nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)
File "/usr/local/lib/python3.5/site-packages/nbconvert/exporters/exporter.py", line 130, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
File "/usr/local/lib/python3.5/site-packages/nbconvert/exporters/exporter.py", line 302, in _preprocess
nbc, resc = preprocessor(nbc, resc)
File "/usr/local/lib/python3.5/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
return self.preprocess(nb,resources)
File "/usr/local/lib/python3.5/site-packages/nbconvert/preprocessors/execute.py", line 83, in preprocess
nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
File "/usr/local/lib/python3.5/site-packages/nbconvert/preprocessors/base.py", line 70, in preprocess
nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
File "/usr/local/lib/python3.5/site-packages/nbconvert/preprocessors/execute.py", line 112, in preprocess_cell
raise CellExecutionError(msg)
nbconvert.preprocessors.execute.CellExecutionError: An error occurred while executing the following cell:
------------------
sqrt(3.)
------------------

NameError: name 'sqrt' is not defined

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]