Jupyter Server Terminals
Jupyter Server Terminals is a Jupyter Server Extension that provides robust terminal support within the Jupyter environment. It allows users to run system shells directly in their web browser, offering functionalities akin to a local terminal. The library is actively maintained, with regular releases focusing on bug fixes and maintenance, and is currently at version 0.5.4. It requires Python >=3.8.
Common errors
-
RuntimeError: Jupyter Server Terminals requires Jupyter Server 2.0+
cause This error occurs when `jupyter-server-terminals` is installed with an older version of `jupyter-server` that does not meet the minimum requirement of 2.0+.fixUpgrade your `jupyter-server` installation to version 2.0 or newer using `pip install --upgrade jupyter-server` or `conda update jupyter-server`. -
Disabling terminals plugin because they are not available on the server.
cause This message, often seen in the browser console, indicates that the Jupyter server-side component for terminals is either not installed, not enabled, or its configuration cannot be found, preventing the client from utilizing terminal functionality.fixEnsure `jupyter-server-terminals` is installed and enabled. Run `pip install jupyter-server-terminals` (or `conda install jupyter-server-terminals -c conda-forge`) and then `jupyter server extension enable jupyter_server_terminals`. -
500 Internal Server Error
cause A '500 Internal Server Error' when interacting with terminals often points to a broader issue with the Jupyter server environment, possibly due to corrupted installations, dependency conflicts (e.g., `tornado` version mismatches), or misconfigurations preventing the server from handling requests correctly.fixTry reinstalling `jupyter-server` and `jupyter-server-terminals` in a clean virtual environment: `pip uninstall jupyter-server jupyter-server-terminals && pip install jupyter-server jupyter-server-terminals`. Also, ensure all Jupyter-related packages are up-to-date and compatible. -
WebSocket connection failed
cause This error signifies a failure in the real-time communication channel between the client (browser) and the Jupyter server, which is essential for interactive terminals, often due to network issues, proxy misconfigurations, or an improperly running Jupyter server.fixCheck for network connectivity issues, verify any proxy configurations (especially in a JupyterHub environment), and ensure the Jupyter server is running without errors in its logs. Sometimes restarting the Jupyter server can resolve transient connection problems.
Warnings
- breaking Jupyter Server Terminals versions 0.5.0 and newer explicitly require Jupyter Server 2.0+ to function correctly. Older versions of Jupyter Server will result in an error during extension loading.
- gotcha The 'Terminals Service' transitioned from a core Jupyter Service to a Jupyter Server extension in Jupyter Server 2.0. While most end-users won't notice, this impacts how the service is managed and can be optionally disabled, which is relevant for sensitive deployment environments or advanced configurations.
- gotcha Jupyter environments (including terminals) can suffer from memory issues, leading to unresponsive sessions or saving errors. This is often due to poor 'server hygiene,' such as not closing notebooks/terminals, excessive output, or inefficient code.
- gotcha On *nix shells in JupyterLab, the default keyboard shortcut for copying (Ctrl+Shift+C) can conflict with the default shortcut for toggling the command palette (`apputils:activate-command-palette`).
- breaking The test script failed with a `SyntaxError` because `pip install` was used as a Python statement. `pip install` is a shell command and cannot be run directly as Python code within a script. This prevents the library from being installed and evaluated.
- breaking The test or installation script attempted to execute a shell command (e.g., `pip install`) directly within a Python script, leading to a `SyntaxError`. This prevents the specified libraries from being installed and the rest of the script from running.
Install
-
pip install jupyter_server_terminals
Imports
- Extension configuration
This library is primarily a Jupyter Server extension. Direct Python imports for programmatic end-user terminal creation or management are not its primary interface. Its functionality is exposed via the Jupyter Server and its web UI (JupyterLab/Notebook).
Quickstart
pip install jupyter_server_terminals jupyterlab jupyter lab