无法使用 jupyter nbcontrib_extensions 中的导出器

Sof*_*fia 9 jupyter-notebook nbconvert

使用这个 Dockerfile:

FROM python:3.7
FROM jupyter/minimal-notebook
WORKDIR $HOME
RUN python -m pip install --upgrade pip
COPY requirements.txt ./requirements.txt
RUN python -m pip  install -r requirements.txt
RUN python -m pip install --upgrade --no-deps --force-reinstall notebook
#
RUN python -m pip install jupyterthemes
RUN python -m pip install --upgrade jupyterthemes
RUN python -m pip install jupyter_contrib_nbextensions
RUN jupyter contrib nbextension install --user
RUN jupyter nbextensions_configurator enable --user

# enable the Nbextensions
RUN jupyter nbextension enable contrib_nbextensions_help_item/main
RUN jupyter nbextension enable execute_time/ExecuteTime 
RUN jupyter nbextension enable codefolding/main
RUN jupyter nbextension enable collapsible_headings/main
RUN jupyter nbextension enable hide_input/main 
RUN jupyter nbextension enable toc2/main
RUN jupyter nbextension enable varInspector/main
Run Code Online (Sandbox Code Playgroud)

使用笔记本时,扩展可以工作(我有一个目录,可折叠标题可以工作等),但是当我尝试使用这些导出器进行导出时(在 之后docker exec..),我收到错误

$ jupyter nbconvert --to html_ch test.ipynb --output test.html
--> jinja2.exceptions.TemplateNotFound: inliner

$ jupyter nbconvert --to html_toc test.ipynb --output test.html
--> jinja2.exceptions.TemplateNotFound: toc
Run Code Online (Sandbox Code Playgroud)

运行 `jupyter --paths:

config:
    /home/jovyan/.jupyter
    /opt/conda/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/jovyan/.local/share/jupyter
    /opt/conda/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /home/jovyan/.local/share/jupyter/runtime
Run Code Online (Sandbox Code Playgroud)

我有.jupyter/jupyter_nbconvert_config.json这个:

{
  "version": 1,
  "Exporter": {
    "template_path": [
      ".",
      "/opt/conda/lib/python3.8/site-packages/jupyter_contrib_nbextensions/templates",
    ],
    "preprocessors": [
      "jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor",
      "jupyter_contrib_nbextensions.nbconvert_support.PyMarkdownPreprocessor"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

列出上面的模板路径,我看到那里的模板:

ls /opt/conda/lib/python3.8/site-packages/jupyter_contrib_nbextensions/templates
collapsible_headings.tpl  highlighter.tplx  nbextensions.tpl   printviewlatex.tplx
highlighter.tpl           inliner.tpl       nbextensions.tplx  toc2.tpl
Run Code Online (Sandbox Code Playgroud)

所以不确定我的 Dockerfile 中缺少什么。

如果我运行这个,jupyter nbconvert --to html test.ipynb --output test.html --template toc2我会收到另一个错误:

ValueError: No template sub-directory with name 'toc2' found in the following paths:
        /home/jovyan/.local/share/jupyter
        /opt/conda/share/jupyter
        /usr/local/share/jupyter
        /usr/share/jupyter
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?