Jupyter Language Server Protocol Server Extension

raw JSON →
2.3.0 verified Tue May 12 auth: no python install: stale quickstart: stale

jupyter-lsp acts as a multi-language server WebSocket proxy for Jupyter Notebook and JupyterLab servers. It enables advanced IDE-like features such as code navigation, hover suggestions, linters, and autocompletion in Jupyter environments by leveraging the Language Server Protocol (LSP). It works in conjunction with a frontend extension, typically `jupyterlab-lsp`, and specific language servers (e.g., `python-lsp-server`). The library is actively maintained, with version 2.3.0 being the current stable release, supporting Python >=3.8.

pip install jupyter-lsp jupyterlab-lsp 'jupyterlab>=4.1.0' python-lsp-server
error LSP features (e.g., autocompletion, diagnostics, hover) not working, or status bar shows "Initialized (additional server needed)"
cause `jupyter-lsp` provides the framework but requires specific language servers (e.g., `python-lsp-server` for Python) to be installed separately, and JupyterLab often needs a restart after installation.
fix
Install the appropriate language server for your desired language (e.g., pip install 'python-lsp-server[all]' or conda install -c conda-forge python-lsp-server). Then, completely restart your JupyterLab server. Verify activation in JupyterLab's "Settings Editor" under "Language Servers (Experimental)".
error Connection lost, reconnecting in 0 seconds." or LSP status indicator stuck at "connecting..."
cause This issue indicates a failure in the WebSocket communication between JupyterLab and the `jupyter-lsp` backend, or between `jupyter-lsp` and the actual language server, often due to a crashing language server, incompatible versions, network/firewall issues, or complex proxy configurations (e.g., in JupyterHub).
fix
Ensure compatible versions of jupyterlab-lsp, jupyter-lsp, and the specific language server are installed. Restart your JupyterLab server. Check the JupyterLab server logs (jupyter lab --debug) for more specific error messages from the language server. If running in a proxied environment like JupyterHub, verify the WebSocket proxy configuration.
error Rscript not found. Please ensure that RScript executable is in the PATH
cause The `r-languageserver` or other R-based LSP servers require the `Rscript` executable to be available in the system's PATH environment variable to function correctly.
fix
Ensure R is properly installed and add the directory containing the Rscript executable (e.g., Rscript.exe on Windows) to your system's PATH environment variable. Restart your terminal session and JupyterLab to apply the PATH changes. You can verify Rscript is in PATH by running Rscript -e "cat(system.file(package='languageserver'))" in your terminal.
gotcha Installing `jupyter-lsp` alone is not enough; you must also install a separate frontend extension (like `jupyterlab-lsp` for JupyterLab) AND at least one language server (e.g., `python-lsp-server` for Python) to get any LSP features. `jupyter-lsp` is only the backend proxy.
fix Ensure `jupyterlab-lsp` is installed for JupyterLab, and install the specific language server(s) for the languages you intend to use.
gotcha JupyterLab (and sometimes Jupyter Notebook) must be restarted after installing `jupyter-lsp` and `jupyterlab-lsp` for the extensions and language servers to be properly recognized and activated.
fix Close and reopen your JupyterLab or Jupyter Notebook session after installation.
gotcha For Python, disabling Jedi (e.g., `%config Completer.use_jedi = False` in IPython or in `ipython_config.py`) can prevent conflicts and improve autocompletion performance when using LSP servers like `python-lsp-server` (which often use Jedi internally).
fix Temporarily run `%config Completer.use_jedi = False` in a notebook cell, or add `c.Completer.use_jedi = False` to your `ipython_config.py` for a permanent solution.
breaking `jupyter-lsp` versions 0.x were designed for Jupyter Notebook Server, while versions 1.x and above are for Jupyter Server. Installing `jupyter-lsp` 2.x with an older Jupyter Notebook environment might lead to unexpected behavior or failure to load.
fix Ensure your Jupyter environment is compatible. For `jupyter-lsp` 2.x, use Jupyter Server or a recent JupyterLab installation (which typically bundles Jupyter Server).
breaking Configuration keys for language servers have changed over time. For example, `language_servers` became `languageServers` and `pyls.serverSettings` became `pylsp.configuration`. Using old configuration keys can prevent language servers from loading or behaving as expected.
fix Consult the `jupyter-lsp` documentation for the correct configuration key names for your installed version. Update your `jupyter_server_config.json` or Python configuration files accordingly.
gotcha By default, Jupyter Server might restrict access to files outside its root directory. For LSP features like 'Jump to Definition' to work with system-wide installed packages or virtual environments, you might need to create a symlink to your system root (e.g., `.lsp_symlink` in your Jupyter root) or configure `jupyter_server_config.py` to allow broader file access.
fix Create a symlink (`.lsp_symlink`) in your Jupyter root pointing to `/` (or `C:\` on Windows), or modify `jupyter_server_config.py` as per documentation to extend file access.
breaking Attempting to run shell commands like `pip install` directly within a Python script (e.g., `/script.py`) will result in a `SyntaxError`. Shell commands must be executed using appropriate methods such as `subprocess.run()` or by running the script from a shell.
fix Execute `pip install jupyter-lsp jupyterlab-lsp 'jupyterlab>=4.1.0'` directly in your shell/terminal, or if running from a Python script, use `import subprocess; subprocess.run(['pip', 'install', 'jupyter-lsp', 'jupyterlab-lsp', 'jupyterlab>=4.1.0'])`.
breaking `pip install` is a shell command and cannot be directly executed as Python syntax within a `.py` file. Attempting to do so will result in a `SyntaxError`.
fix Ensure `pip install` commands are executed in a shell environment (e.g., via a `.sh` script or directly in the terminal). If running from a Python script, use `subprocess.run(['pip', 'install', 'package_name'])` or similar methods to invoke shell commands.
conda install -c conda-forge jupyter-lsp jupyterlab-lsp 'jupyterlab>=4.1.0' python-lsp-server
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - - 195.8M
3.10 alpine (musl) - - - -
3.10 slim (glibc) wheel 16.6s - 181M
3.10 slim (glibc) - - - -
3.11 alpine (musl) wheel - - 208.1M
3.11 alpine (musl) - - - -
3.11 slim (glibc) wheel 17.8s - 194M
3.11 slim (glibc) - - - -
3.12 alpine (musl) wheel - - 212.7M
3.12 alpine (musl) - - - -
3.12 slim (glibc) wheel 15.7s - 202M
3.12 slim (glibc) - - - -
3.13 alpine (musl) wheel - - 212.6M
3.13 alpine (musl) - - - -
3.13 slim (glibc) wheel 15.2s - 201M
3.13 slim (glibc) - - - -
3.9 alpine (musl) wheel - - 195.2M
3.9 alpine (musl) - - - -
3.9 slim (glibc) wheel 18.9s - 180M
3.9 slim (glibc) - - - -

This quickstart guides you through installing `jupyter-lsp`, its JupyterLab frontend counterpart `jupyterlab-lsp`, and a common Python language server. After installation, a restart of JupyterLab is crucial for the extensions to be recognized. Language server configurations can then be managed through JupyterLab's settings.

# Install jupyter-lsp and the JupyterLab frontend extension
pip install jupyter-lsp jupyterlab-lsp 'jupyterlab>=4.1.0'

# Install a language server for Python (e.g., python-lsp-server)
pip install python-lsp-server

# If using other languages, install their respective LSP servers, e.g., for R:
# Rscript -e 'install.packages("languageserver")'

# After installation, restart your JupyterLab instance to enable the extensions.
# You can then verify the installation and configure language servers via:
# JupyterLab Settings -> Settings Editor -> Language Servers (Experimental)

# Example of how you might enable the server extension if not auto-detected (less common now):
# jupyter server extension enable jupyter_lsp --py --sys-prefix

# To verify server extensions are enabled (run in terminal):
# jupyter server extension list