Update jupyter lab to v4

and perform all unit tests with tqdm, ipywidget, plotly and everything
jupyter
plotly
Published

October 5, 2023

As mentionned in logbook May-23, jupyter lab v4 is now available.

image.png

clean jupyterlab config files

2 config files in linux:

  • .jupyter

  • .local/share/jupyter

I have removed them (actually mv with _backup_<date> suffix

create base_jupyter_v4 environment

Here is how I created it

conda remove --name base_jupyter_v4 --all
1mamba create -n base_jupyter_v4 --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab ipywidgets tqdm nb_conda_kernels python==3.11 --yes
mamba activate base_jupyter_v4

# clean directories: .jupyter and .local/share/jupyter
# and launch with `jupyter lab`

2mamba install -y -c conda-forge -c plotly jupyter-dash
3mamba install -y -c conda-forge jupyterlab_execute_time

4mamba install -y -c conda-forge pyviz_comms
5pip install jupyterlab-quarto
1
tqdm available for all kernels, nb_conda_kernels kernels are already listed against each conda environment (I won’t manually install kernels anymore python -m ipykernel install --user --name=my_env)
2
plotly extension
3
execute time
4
in case of holoviz usage (see datashadering), pyviz_comms version >=3.0 required
5
in case of nbdev usage: https://quarto.org/docs/tools/jupyter-lab-extension.html

launch it as a service

As explained in WSL2 on a fresh new PC / jupyter lab

I have setup jupyterlab as a service. Jupyter lab is automatically started with WSL.

thanks to - /etc/systemd/system/jupyter.service nothing to be changed here

  • ~/bin/jupyterlab
!cat /home/guillaume/bin/jupyterlab
#!/bin/bash
cd ~
source ~/miniconda/etc/profile.d/conda.sh
conda activate base_jupyter_v4
export BROWSER=chrome.exe
jupyter lab

Then enable this service

chmod +x /home/guillaume/bin/jupyterlab.sh
sudo systemctl daemon-reload
sudo systemctl enable jupyter.service
sudo systemctl restart jupyter.service

and to monitor logs of this service

journalctl -xefu jupyter

Just pointing to http://localhost:8888/lab

upgrade jupyter lab version

In case of update detected in jupyter lab version.

Here is my procedure.

mamba activate base_jupyter_v4
sudo systemctl stop jupyter
mamba update --strict-channel-priority -c conda-forge -c nodefaults  jupyterlab
sudo systemctl start jupyter

unit test

tqdm

from tqdm.notebook import trange, tqdm
from time import sleep

for i in trange(3, desc='1st loop'):
    for j in tqdm(range(100), desc='2nd loop'):
        sleep(0.01)

ipywidgets

import ipywidgets
ipywidgets.__version__
'8.1.1'
ipywidgets.widgets.Button(description="Hello World!")