如何解决Jupyter Notebook:nbconvert 模板本地化问题
在 conda 环境中使用 jupyter 服务器期间,我遇到了 nbconvert 模板本地化问题。 jupyter 服务器正在 /usr/local/share/jupyter/nbconvert/templates
中寻找这些,但当前不存在此本地化(可能已经存在过一次)。
为什么他不在 ~/.conda/pkgs/nbconvert-6.0.7-py37_0/share/jupyter/nbconvert/templates/
中寻找这些,因为他应该与 env 隔离?。我不知道此路径存储在哪里以及如何解决此问题...
作为回报,每当我想打开任何 500: Internal Server Error
文件时,我都会得到 .ipynb
。
对应输出:
[I 21:08:20.635 NotebookApp] Serving notebooks from local directory: /home/tancredi
[I 21:08:20.635 NotebookApp] Jupyter Notebook 6.3.0 is running at:
[I 21:08:20.635 NotebookApp] http://localhost:8888/?token=6ac6a4f804ffd86bcf516f03d35d46ccc9afe74174cc273c
[I 21:08:20.635 NotebookApp] or http://127.0.0.1:8888/?token=6ac6a4f804ffd86bcf516f03d35d46ccc9afe74174cc273c
[I 21:08:20.635 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 21:08:20.648 NotebookApp]
To access the notebook,open this file in a browser:
file:///home/tancredi/.local/share/jupyter/runtime/nbserver-4308-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=6ac6a4f804ffd86bcf516f03d35d46ccc9afe74174cc273c
or http://127.0.0.1:8888/?token=6ac6a4f804ffd86bcf516f03d35d46ccc9afe74174cc273c
[E 21:08:34.603 NotebookApp] Uncaught exception GET /notebooks/Projects/research-project/Untitled.ipynb (::1)
HTTPServerRequest(protocol='http',host='localhost:8888',method='GET',uri='/notebooks/Projects/research-project/Untitled.ipynb',version='HTTP/1.1',remote_ip='::1')
Traceback (most recent call last):
File "/home/tancredi/.conda/envs/test/lib/python3.7/site-packages/tornado/web.py",line 1543,in _execute
result = yield result
File "/home/tancredi/.conda/envs/test/lib/python3.7/site-packages/tornado/gen.py",line 1099,in run
value = future.result()
File "/home/tancredi/.conda/envs/test/lib/python3.7/site-packages/tornado/gen.py",line 1113,in run
yielded = self.gen.send(value)
File "/home/tancredi/.local/lib/python3.7/site-packages/notebook/notebook/handlers.py",line 101,in get
get_frontend_exporters=get_frontend_exporters
File "/home/tancredi/.local/lib/python3.7/site-packages/notebook/base/handlers.py",line 516,in render_template
return template.render(**ns)
File "/home/tancredi/.conda/envs/test/lib/python3.7/site-packages/jinja2/environment.py",line 1289,in render
self.environment.handle_exception()
File "/home/tancredi/.conda/envs/test/lib/python3.7/site-packages/jinja2/environment.py",line 924,in handle_exception
raise rewrite_traceback_stack(source=source)
File "/home/tancredi/.local/lib/python3.7/site-packages/notebook/templates/notebook.html",line 1,in top-level template code
{% extends "page.html" %}
File "/home/tancredi/.local/lib/python3.7/site-packages/notebook/templates/page.html",line 154,in top-level template code
{% block header %}
File "/home/tancredi/.local/lib/python3.7/site-packages/notebook/templates/notebook.html",line 115,in block 'header'
{% for exporter in get_frontend_exporters() %}
File "/home/tancredi/.local/lib/python3.7/site-packages/notebook/notebook/handlers.py",line 40,in get_frontend_exporters
for name in get_export_names():
File "/home/tancredi/.local/lib/python3.7/site-packages/nbconvert/exporters/base.py",line 141,in get_export_names
e = get_exporter(exporter_name)(config=config)
File "/home/tancredi/.local/lib/python3.7/site-packages/nbconvert/exporters/base.py",line 102,in get_exporter
if getattr(exporter(config=config),'enabled',True):
File "/home/tancredi/.local/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py",line 325,in __init__
super().__init__(config=config,**kw)
File "/home/tancredi/.local/lib/python3.7/site-packages/nbconvert/exporters/exporter.py",line 114,in __init__
self._init_preprocessors()
File "/home/tancredi/.local/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py",line 491,in _init_preprocessors
conf = self._get_conf()
File "/home/tancredi/.local/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py",line 509,in _get_conf
if conf_path.exists():
File "/home/tancredi/.conda/envs/test/lib/python3.7/pathlib.py",line 1361,in exists
self.stat()
File "/home/tancredi/.conda/envs/test/lib/python3.7/pathlib.py",line 1183,in stat
return self._accessor.stat(self)
PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter/nbconvert/templates/html/conf.json'
[E 21:08:34.611 NotebookApp] {
"Host": "localhost:8888","Connection": "keep-alive","Sec-Ch-Ua": "\" Not A;Brand\";v=\"99\",\"Chromium\";v=\"90\"","Sec-Ch-Ua-Mobile": "?0","Upgrade-Insecure-Requests": "1","User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/90.0.4430.214 Safari/537.36","Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","sec-fetch-site": "same-origin","sec-fetch-mode": "navigate","Sec-Fetch-User": "?1","Sec-Fetch-Dest": "document","Referer": "http://localhost:8888/tree/Projects/research-project","Accept-Encoding": "gzip,deflate,br","Accept-Language": "en-US,en;q=0.9,pl;q=0.8","Cookie": "_xsrf=2|3a458c10|53e0d6160a255c20300fc84eb3afb013|1622985389; username-localhost-8889=\"2|1:0|10:1623002006|23:username-localhost-8889|44:MjA0MGY4ZTVkNjUzNDQ2MGFkOTYyYjYyNjQ5M2MxM2Y=|aad4b0e85d408d80fd0115329cca0e4694cce7ab88bc53f0b2d0c2cff76f5b77\"; username-localhost-8890=\"2|1:0|10:1623004893|23:username-localhost-8890|44:MWY0MWRlMDI4N2IwNDllODhiNDgzNDhhYjYzZDIzYTY=|3c939b9f467f84fb5d5894d90ddbcc24fc4301f8549df892a33b79b3b191d4a1\"; username-localhost-8891=\"2|1:0|10:1623005508|23:username-localhost-8891|44:Njk4Njg4MTg1ZjNmNDNhNmFmYWUwMjA5ZjY1OTQzYTI=|976f0afc6b887e737c5b09d11fe3d1d2f17ba6a13676a47d5ad6532632e7e0b2\"; username-localhost-8888=\"2|1:0|10:1623006502|23:username-localhost-8888|44:ZTc2ZDdmZTQ2NWEyNDgzMjg4YTk0YmE4YjAyMWE3ZGI=|1e02f6d6453d25df2685a2580f83c97fde29c33aa846deb98062f016ee5ec642\""
}
[E 21:08:34.611 NotebookApp] 500 GET /notebooks/Projects/research-project/Untitled.ipynb (::1) 211.940000ms referer=http://localhost:8888/tree/Projects/research-project
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。