我正在运行一个pythonazure函数,它通过nbconvert
API运行一个jupyter笔记本。这已经运行了一段时间,但在没有部署新代码的情况下,我开始出现以下错误:
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解决了我的问题
对于我来说,使用以下方法卸载和安装nbconvert:
修正了这个错误
pip install -U nbconvert
安装.../site-packages/share/jupyter/nbconvert/templates/
但是
jupyter nbconvert my.ipynb --to python
看不到那里--在其中一个中创建一个到
.../site-packages/.../templates
的符号链接,例如相关问题 更多 >
编程相关推荐