`jupyterlmod` extension does not update `$PYTHONPATH` for Jupyter Notebook

I am just a user of our University’s Open OnDemand and trying to run a custom JupyterLab installed using Spack.

I simply use the following script in the Jupyter Notebook application with OOD, and launch a jupyterlab session:

#!/bin/bash

# load custom module system
. /work/comphyd_lab/local/modules/spack/2024v5/lmod-init-bash
ml unuse $MODULEPATH
ml use /work/comphyd_lab/local/modules/spack/2024v5/modules/linux-rocky8-x86_64/Core/
ml load py-jupyterlab
ml load node-js
ml load py-terminado
ml load py-pip

# As per https://rcs.ucalgary.ca/index.php/Jupyter_Notebooks
unset XDG_RUNTIME_DIR

# make the NotebookApp values into ServerApp for JupyterLab
sed -i 's/NotebookApp/ServerApp/g' "${CONFIG_FILE}"
sed -i 's/notebook_dir/root_dir/g' "${CONFIG_FILE}"

# Launch the Jupyter Notebook Server
set -x
jupyter lab --config="${CONFIG_FILE}"

I also have the jupyterlmod extension installed. When I try to load/unload my modules, the $PYTHONPATH environment remains unchanged, but $PATH on other variables change without any issues. The default $PYTHONPATH lists all the values that I had to load once for launching my JupyterLab session.

Why jupyterlmod cannot update $PYTHONPATH variable?

Hi and welcome!

I think you’ll find much more expertise on the github ticket you’ve opened for the same. Once that resolves and we know more about how jupyterlmod behaves and if the issue persists or needs to be taken care of at the OOD level, we’re happy to help.