Please Read This First#
Delivering LSP features to your JupyterLab requires three pieces:
runs in your
jupyter_serverapplication on your server to handle requests from the browser to language servers
to run, you need:
runs in your browser, as an extension to JupyterLab
to install it, you need:
3. Language Servers#
run on your server
probably in another language runtime than python
some can be automatically detected if installed
others also need to be configured
The approaches demonstrated below will ensure that correct versions of Python,
JupyterLab and extensions are installed, and are generally recommended for
novice users, or users who are not familiar with the Python ecosystem. However,
if you feel proficient with using Python package managers such as
conda you may prefer to follow the custom installation
guide instead, which allows to install the packages in an existing environment.
conda (minimal python)#
When installing from conda-forge, the
jupyter-lsp-python bundle includes both
the server extension (
pyls (a third-party server also known
python-language-server). You can swap
jupyter-lsp-python with another
jupyter-lsp-r to get get the same server extension but with
r-languageserver instead. Alternatively, you can install a language server of
your choice manually (see further steps).
conda create -c conda-forge -n lsp 'python >=3.7,<3.11.0a0' 'jupyterlab=3.1.0' 'jupyterlab-lsp=3.10.1' 'jupyter-lsp-python=1.5.1' conda activate lsp
Your browser should open to your local server.
docker (data science)#
This approach is based roughly on the Jupyter docker-stacks documentation, which should be consulted for more about connecting volumes, passwords, and other advanced features:
Note: docker instructions were not updated for JupyterLab 3.0 and extension 3.0. Please consider submitting a PR to fix it.
# This already contains the python, r, julia, latex, and nodejs runtimes FROM jupyter/datascience-notebook@sha256:73a577b006b496e1a1c02f5be432f4aab969c456881c4789e0df77c89a0a60c2 RUN conda install --quiet --yes --freeze-installed -c conda-forge \ 'python-language-server' \ 'jupyterlab=3.1.0' \ 'r-languageserver' \ 'texlab' \ 'chktex' \ 'jupyter-lsp=1.5.1' \ && jupyter labextension install --no-build \ '@firstname.lastname@example.org' \ && jupyter lab build --dev-build=False --minimize=True \ && conda clean --all -f -y \ && rm -rf \ $CONDA_DIR/share/jupyter/lab/staging \ /home/$NB_USER/.cache/yarn \ && fix-permissions $CONDA_DIR \ && fix-permissions /home/$NB_USER
version: '2' services: lsp-lab: build: . ports: - '18888:8888'
Build and Start#
You should now be able to access
http://localhost:18888/lab, using the
provided in the log.
Get a working JupyterLab environment#
Refer to the official JupyterLab Installation Documentation for your installation approach.
Verify your lab works:
jupyter lab --version jupyter lab
Install Jupyter[Lab] LSP#
conda install jupyterlab-lsp=3.10.1
pip install jupyterlab-lsp==3.10.1
Next step: Language Servers#
Now that you have
jupyter-lsp and all of their dependencies,
you’ll need some language servers. See: