【发布时间】:2021-01-05 13:25:35
【问题描述】:
我正在运行一个 python azure 函数,该函数通过nbconvert API 运行一个 jupyter notebook。这工作了一段时间,虽然没有部署新代码我开始收到以下错误:
No template sub-directory with name 'lab' found in the following paths:
/home/.local/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
我用来实现这一点的代码是:
from nbconvert.preprocessors import ExecutePreprocessor
from nbconvert import HTMLExporter
...
dl = DictLoader({'footer':
"""
{%- extends 'full.tpl' -%}
{% block input_group %}
{%- if cell.metadata.get('nbconvert', {}).get('show_code', False) -%}
((( super() )))
{%- endif -%}
{% endblock input_group %}
{% block output_group %}
<style> .output_prompt{visibility:hidden;}</style>
{{ super() }}
{% endblock output_group %}
"""})
...
html_exporter = HTMLExporter(extra_loaders=[dl], template_file='footer')
html_exporter.template_name = 'classic'
with open(JUPYTER_DIR + NOTEBOOK_NAME) as f:
nb = nbformat.read(f, as_version=4)
ep = ExecutePreprocessor(timeout=600, kernel_name='python')
ep.preprocess(nb, {'metadata': {'path': JUPYTER_DIR}})
(body, resources) = html_exporter.from_notebook_node(nb)
functionapp 正在运行以下内容:
python3.6
nbconvert6.0.3
jupyter-lab0.1.1
我已经尝试在谷歌上搜索错误,到目前为止我发现的最接近的东西是this,它很相似,但没有得到答复,并不完全相同。以为我会在这里发帖,看看是否有人知道如何解决,或者如果我设法解决问题,我会更新。
我很困惑,因为lab 不是我熟悉的关键字(可能在jupyterlab 之外)并且没有在代码中使用。
至于提到的路径:
-
home/.local/share/jupyter/存在并包含nbconvert/templates/html -
usr/local/share/jupyter&usr/share/jupyter不存在
提前感谢您的帮助!
【问题讨论】:
标签: python jupyter-notebook azure-functions jupyter nbconvert