python - 在以下路径中找不到名称为 'lab' 的模板子目录

标签 python jupyter-notebook azure-functions jupyter nbconvert

我正在运行一个 python azure 函数,它通过 nbconvert 运行一个 jupyter 笔记本。 API。这工作了一段时间,虽然没有部署新代码,但我开始收到以下错误:

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不存在

  • 提前感谢您的帮助!

    最佳答案

    将 nbconvert 升级到 6.0.8 后,我遇到了同样的问题。
    回滚到 nbconvert 5.6.1 为我解决了这个问题。

    pip uninstall nbconvert
    pip install nbconvert==5.6.1

    关于python - 在以下路径中找不到名称为 'lab' 的模板子目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63958574/

    相关文章:

    python - HTTP 错误 : HTTP Error 403: Forbidden on Google Colab

    azure - 我可以通过位于不同资源组和消耗计划中的 Durable Functions 实现 Azure 函数链吗?

    python - 使用 ExceltoCi 将数据加载到 Peoplesoft 数据库中

    python - PySpark 中日期时间的舍入时间

    python - 如何从 Jupyter 笔记本中删除 emacs 键绑定(bind)?

    python - 如何在 python 中获取用于 SQL 查询的表列名/表头

    azure - 应该 +(加号)符号用于 Azure Functions 2 中的路由

    azure - 在 Azure Functions 中,我可以将 C# HttpTrigger 与 Python HttpTrigger 结合起来吗

    python - 从实例中获取模型名称

    python - 计算文件每一行的每个单词的字符数