Sage: problem launching a Jupyter session
I followed the installation instructions to the tee and running sage in the shell indeed gives a working Sage interactive command line session. But I could not get sage -n jupyter to work; here are the logs:
(sage) root@codespaces-b4d8c4:/workspaces/Self-Study# sage -n jupyter
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.7, Release Date: 2025-08-09 │
│ Using Python 3.12.12. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...
/root/conda/envs/sage/lib/python3.12/site-packages/tornado/ioloop.py:271: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
/root/conda/envs/sage/lib/python3.12/site-packages/traitlets/traitlets.py:3913: DeprecationWarning: Keyword `trait` is deprecated in traitlets 5.0, use `value_trait` instead
warn(
/root/conda/envs/sage/lib/python3.12/site-packages/traitlets/traitlets.py:3615: DeprecationWarning: Traits should be given as instances, not types (for example, `Int()`, not `Int`). Passing types is deprecated in traitlets 4.1.
super().__init__(trait=trait, default_value=default_value, **kwargs)
[I 2026-01-22 13:46:51.215 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2026-01-22 13:46:51.226 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2026-01-22 13:46:51.240 ServerApp] jupyterlab | extension was successfully linked.
[I 2026-01-22 13:46:51.253 ServerApp] notebook | extension was successfully linked.
[I 2026-01-22 13:46:51.262 ServerApp] Writing Jupyter server cookie secret to /root/.local/share/jupyter/runtime/jupyter_cookie_secret
/root/conda/envs/sage/lib/python3.12/site-packages/traitlets/traitlets.py:1897: DeprecationWarning: ServerApp.token config is deprecated in jupyter-server 2.0. Use IdentityProvider.token
return t.cast(Sentinel, self._get_trait_default_generator(names[0])(self))
[I 2026-01-22 13:46:51.294 ServerApp] notebook_shim | extension was successfully linked.
[I 2026-01-22 13:46:51.343 ServerApp] notebook_shim | extension was successfully loaded.
/root/conda/envs/sage/lib/python3.12/site-packages/jupyter_server/extension/manager.py:126: DeprecationWarning: A `_load_jupyter_server_extension` function was not found in <module 'jupyter_lsp' from '/root/conda/envs/sage/lib/python3.12/site-packages/jupyter_lsp/__init__.py'>. Instead, a `load_jupyter_server_extension` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
loader = get_loader(loc)
[I 2026-01-22 13:46:51.355 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2026-01-22 13:46:51.361 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2026-01-22 13:46:51.395 LabApp] JupyterLab extension loaded from /root/conda/envs/sage/lib/python3.12/site-packages/jupyterlab
[I 2026-01-22 13:46:51.395 LabApp] JupyterLab application directory is /root/conda/envs/sage/share/jupyter/lab
[I 2026-01-22 13:46:51.395 LabApp] Extension Manager is 'pypi'.
[I 2026-01-22 13:46:51.607 ServerApp] jupyterlab | extension was successfully loaded.
[I 2026-01-22 13:46:51.622 ServerApp] notebook | extension was successfully loaded.
[C 2026-01-22 13:46:51.625 ServerApp] Running as root is not recommended. Use --allow-root to bypass.
(sage) root@codespaces-b4d8c4:/workspaces/Self-Study# sage -n --allow-root jupyter
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.7, Release Date: 2025-08-09 │
│ Using Python 3.12.12. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...
[C 2026-01-22 13:47:21.550 ServerApp] No such file or directory: /workspaces/Self-Study/jupyter
For full reproducibility, I now note that this is done in a GitHub Codespace with a .devcontainer folder containing three files
.devcontainer.jsonpostCreateCommandsDockerFIle
I was going to post the code contents of each… but I can’t because my karma is insufficient to publish links? (Also, why does three backticks not seem to work to give a code block? I’ve never had this issue on any other site.)
One might question why I don’t just use FROM: sagemath/sagemath:latest. The answer is that this is the setup for my GitHub Codespace, which is primarily meant to be a TeX coding environment, but sometimes I might want to write some Julia/Sage/etc scripts.