Installing nbdime
will automatically pull in the latest release of jupyter_server
which is currently version 2.0.1
. If you run nbdiff-web
with jupyter_server>=2
you'll encounter the errors below and the web-ui won't render.
System information:
- OS: macOS Monterey (12.6)
- Platform: x86
- Python: 3.9.15 (via pyenv)
- nbdime: 3.1.1
Steps to reproduce:
# In a fresh environment
pip install nbdime ipython_genutils
nbdiff-web base-notebook.ipynb changed-notebook.ipynb
Workaround:
pip install jupyter_server==1.23.3 nbdime ipython_genutils
nbdiff-web base-notebook.ipynb changed-notebook.ipynb
Errors:
[I nbdimeserver:422] Listening on 127.0.0.1, port 64307
[I webutil:29] URL: http://127.0.0.1:64307/diff?base=basic-notebook-main.ipynb&remote=basic-notebook.ipynb
[W warnings:109] /Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/base/handlers.py:234: UserWarning: The Tornado web application does not have an 'identity_provider' defined in its settings. In future releases of jupyter_server, this will be a required key for all subclasses of `JupyterHandler`. For an example, see the jupyter_server source code for how to add an identity provider to the tornado settings: https://github.com/jupyter-server/jupyter_server/blob/aa8fd8b3faf37466eeb99689d5555314c5bf6640/jupyter_server/serverapp.py#L253
warnings.warn(
[E web:1798] Uncaught exception GET /diff?base=basic-notebook-main.ipynb&remote=basic-notebook.ipynb (127.0.0.1)
HTTPServerRequest(protocol='http', host='127.0.0.1:64307', method='GET', uri='/diff?base=basic-notebook-main.ipynb&remote=basic-notebook.ipynb', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/tornado/web.py", line 1692, in _execute
result = await result
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 602, in prepare
_user = await _user
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/auth/identity.py", line 237, in _get_user
_cookie_user = self.get_user_cookie(handler)
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/auth/identity.py", line 395, in get_user_cookie
_user_cookie = handler.get_secure_cookie(
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/tornado/web.py", line 773, in get_secure_cookie
self.require_setting("cookie_secret", "secure cookies")
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/tornado/web.py", line 1592, in require_setting
raise Exception(
Exception: You must define the 'cookie_secret' setting in your application to use secure cookies
[E web:1221] Uncaught exception in write_error
Traceback (most recent call last):
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/tornado/web.py", line 1692, in _execute
result = await result
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 602, in prepare
_user = await _user
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/auth/identity.py", line 237, in _get_user
_cookie_user = self.get_user_cookie(handler)
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/auth/identity.py", line 395, in get_user_cookie
_user_cookie = handler.get_secure_cookie(
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/tornado/web.py", line 773, in get_secure_cookie
self.require_setting("cookie_secret", "secure cookies")
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/tornado/web.py", line 1592, in require_setting
raise Exception(
Exception: You must define the 'cookie_secret' setting in your application to use secure cookies
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/tornado/web.py", line 1219, in send_error
self.write_error(status_code, **kwargs)
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/nbdime/webapp/nbdimeserver.py", line 72, in write_error
return super(NbdimeHandler, self).write_error(status_code, **kwargs)
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 698, in write_error
html = self.render_template("%s.html" % status_code, **ns)
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 624, in render_template
ns.update(self.template_namespace)
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 634, in template_namespace
logged_in=self.logged_in,
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 179, in logged_in
user = self.current_user
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/tornado/web.py", line 1345, in current_user
self._current_user = self.get_current_user()
File "/Users/MYUSER/.local/share/virtualenvs/sample-notebooks-5G7S8U4h/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 158, in get_current_user
raise RuntimeError(msg)
RuntimeError: Calling `MainDiffHandler.get_current_user()` directly is deprecated in jupyter-server 2.0. Use `self.current_user` instead (works in all versions).
[E log:75] {
"Host": "127.0.0.1:64307",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Firefox/107.0"
}
[E log:76] 500 GET /diff?base=basic-notebook-main.ipynb&remote=basic-notebook.ipynb (@127.0.0.1) 7.53ms referer=None