You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is assumed that you either completed the previous tutorial "Basic JupyterLab customizations" or that you already have basic knowledge of containerization and JupyterLab customizing.
21
+
22
+
With this knowledge, we'll add some more advanced customizations to JupyterLab and look at some pitfalls.
23
+
24
+
# Installing an additional Kernel
25
+
26
+
One common szenario for customization is the need for an additional kernel, e.g. for Julia or R. This tutorial guides you through installing a rust kernel on top of `minimal-notebook` as an example.
27
+
28
+
> <comment-title>Jupyter Kernels</comment-title>
29
+
>
30
+
> A list of availible Jupyter Kernels can be found at [https://github.com/jupyter/jupyter/wiki/Jupyter-kernels](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels)
31
+
{: .comment}
32
+
33
+
If you look for `Rust` you'll find the `Evcxr` Jupyter Kernel which is the one we are going to add.
34
+
35
+
> <comment-title>Evcxr Kernel</comment-title>
36
+
>
37
+
> All relevant information for the Evcxr Kernel can be found at [https://github.com/evcxr/evcxr/tree/main/evcxr_jupyter](https://github.com/evcxr/evcxr/tree/main/evcxr_jupyter)
38
+
{: .comment}
39
+
40
+
> <hands-on-title></hands-on-title>
41
+
>
42
+
> Create a new directory. Inside, create a `Dockerfile` with the following content:
43
+
>
44
+
> ```
45
+
> FROM quay.io/jupyter/minimal-notebook:2025-06-23
> Again, we are using `minimal-notebook` as base image. But this time we need to do more than just installing a python package:
65
+
> 1. we need to install system packages to meet requirements for Rust
66
+
> 2. we need to install Rust itself
67
+
> 3. we need to install and register the Evcxr kernel
68
+
>
69
+
> In order to install system packages, we need a privileged user inside the docker build, which is why we are changing to the root user using the `USER` keyword. When installing packages, keep in mind that docker builds are non-interactive, thus you need to use the `-y` flag to bypass the confirmation prompt.
70
+
>
71
+
> After installing system files, we can return to the JupyterLab default user, who is usually called `jovyan`. The variable `NB_UID` is inherited from the base image.
72
+
>
73
+
> Next, the rustup utility will be downloaded and executed. Note, with the `--chmod` portion you can tell `ADD` in which filemod to save the downloaded file, thus you do not need to make the file executable in a separate step.
74
+
> The rustup script installs the binaries for rust in `${HOME}/.cargo/bin` which is why we need to add it to the path. We can do that simply by using the `ENV` keyword.
75
+
>
76
+
> At least, we install and register the Evcxr as explained on the projects github page.
77
+
{: .question}
78
+
79
+
> <hands-on-title>Build your JupyterLab</hands-on-title>
80
+
>
81
+
> ```bash
82
+
> sudo docker build -t my-rust-jupyterlab .
83
+
> ```
84
+
{: .hands_on}
85
+
86
+
> <hands-on-title>Run your JupyterLab</hands-on-title>
87
+
>
88
+
> ```bash
89
+
> sudo docker run --rm -p 127.0.0.1:8888:8888 my-rust-jupyterlab .
90
+
> ```
91
+
{: .hands_on}
92
+
93
+
> <hands-on-title>Try your JupyterLab</hands-on-title>
94
+
>
95
+
> Again, you'll be provided with a link to open your JupyterLab.
96
+
>
97
+
> Open it, click on the Rust kernel and run following snippet:
98
+
> ```rust
99
+
> println!("Hello World!");
100
+
> ```
101
+
{: .hands_on}
102
+
103
+
Congratulations, you have successfully installed a custom kernel to your JupyterLab!
104
+
105
+
# Configuration Changes
106
+
107
+
There are a few files for configuring JupyterLab. One important one is the `jupyter_lab_config.py` file, where you can configure various different settings, e.g. the log level of the server application and much more.
108
+
109
+
> <comment-title></comment-title>
110
+
>
111
+
> All relevant configuration options for `jupyter_lab_config.py` can be found at [https://jupyter-server.readthedocs.io/en/latest/other/full-config.html](https://jupyter-server.readthedocs.io/en/latest/other/full-config.html)
112
+
{: .comment}
113
+
114
+
You might include this file either as a user configuration in the user's home directory like this: `${HOME}/.jupyter/jupyter_lab_config.py`. But you better include it as a system-wide configuration by including it as `/etc/jupyter/jupyter_lab_config.py`. You can find out why this is the better solution in the [persistent data](#persistent-data) section.
115
+
116
+
> <hands-on-title>Include your custom configuration</hands-on-title>
117
+
>
118
+
> First, create a snippet of custom config, e.g. let's edit the default name for Notebooks from "Untitled" to "HelloWorld". Save it as `jupyter_lab_config.py`:
> sudo docker run --rm -p 127.0.0.1:8888:8888 my-configured-jupyterlab .
142
+
> ```
143
+
>
144
+
> ...and access it with the printed URL. Now, open a new Notebook Document and you'll see it is now called `HelloWorld.ipynb` instead of `Untitled.ipynb`.
145
+
{: .hands_on}
146
+
147
+
Congratulations, you have successfully configured your JupyterLab with a custom configuration! While this example handles a very low impact customization, please review the available configuration options! You may also configure plugins that way, as you will learn later in the [Application Proxies](#application-proxies) section.
84
148
85
149
# Persistent Data
86
150
87
-
* HomeDir will be overlayed with a mounted Volume
151
+
Even though persistent data is not strictly a topic of customization, it is a relevant topic that you have to keep in mind when customizing your JupyterLab.
88
152
89
-
* WIP
153
+
Running JupyterLab in a container, means that your data may be lost when the container is removed. To avoid data loss, volumes can be used.
90
154
91
-
## External persistent Data
155
+
--> On local machine, mount it wherever you want
92
156
93
-
* Depends on your environment
157
+
--> Bind mount vs actual volume
94
158
95
-
* WIP
159
+
--> With JupyterHub it's common to overlay homedir
0 commit comments