问题描述
使用此 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
使用笔记本时,扩展工作(我有一个目录,可折叠标题工作等)但是当我尝试使用这些导出器导出时(在 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
运行`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
在 .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"
]
}
}
列出上面的模板路径,我看到那里的模板:
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
所以不确定我的 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
有什么想法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)