Skip to content

Commit 6916dbe

Browse files
committed
add info about uenvs
1 parent cc8e61c commit 6916dbe

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

docs/services/jupyterlab.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,35 @@ Alternatively, you can issue the following command directly in a notebook cell:
3535

3636
A kernel, in the context of Jupyter, is a program that runs the user code within the Jupyter notebooks. Jupyter kernels make it possible to access virtual environments, custom python installations like anaconda/miniconda or any custom python setting, from Jupyter notebooks.
3737

38-
A kernel can be created from an active Python virtual environment with  `ipykernel` :
39-
38+
Jupyter kernels are powered by [`ipykernel`](https://github.com/ipython/ipykernel).
39+
As a result, `ipykernel` must be installed in every environment that will be used as a kernel.
40+
That can be done with `pip install ipykernel`.
41+
A kernel can be created from an active Python virtual environment with the following commands
4042

4143
```console title="Create a Jupyter kernel"
4244
. /myenv/bin/activate
43-
python -m ipykernel install --user --name=<your_env_name> --display-name "Python (<your_env_name>)"
45+
python -m ipykernel install --user --name="<kernel-name>" --display-name="<kernel-name>"
4446
```
4547

46-
Jupyter kernels are powered by [`ipykernel`](https://github.com/ipython/ipykernel). As a result, `ipykernel` must be installed in every environment that will be used as a kernel. That could be done with `pip install ipykernel`.
48+
## Using Uenvs in JupyterLab
49+
50+
In the JupyterHub Spawner Options form mentioned above, it's possible to pass an Uenv and a view.
51+
The Uenv will be mounted at `/user-environment`, and the specified view will be activated.
52+
53+
If the Uenv includes the installation of a Python package, you will need to create a Jupyter kernel to make the package available in the notebooks.
54+
If `ipykernel` is not available in the Uenv, you can create a Python virtual environment in a terminal within JupyterLab and install it there
55+
56+
```console
57+
cd $SCRATCH
58+
python -m venv uenv-pyenv --system-site-packages
59+
pip install ipykernel
60+
```
61+
62+
Then with that virtual environment activated, you can run the command to create the Jupyter kernel.
63+
64+
!!! warning "Using remote Uenvs for the first time."
65+
If the Uenv is not present in the local repository, it will be automatically fetched.
66+
As a result, JupyterLab may take slightly longer than usual to start.
4767

4868
## Ending your interactive session and logging out
4969

0 commit comments

Comments
 (0)