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

**URL:** <https://discourse.openondemand.org/t/jupyterlmod-extension-does-not-update-pythonpath-for-jupyter-notebook/4107>\
**Category:** Get Help\
**Tags:** question\
**Created:** [March 10, 2025, 9:37pm UTC](https://discourse.openondemand.org/t/jupyterlmod-extension-does-not-update-pythonpath-for-jupyter-notebook/4107 "2025-03-10T21:37:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kasra-keshavarz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/kasra-keshavarz/32/2656_2.png) [@kasra-keshavarz](https://discourse.openondemand.org/u/kasra-keshavarz)\
**Post date:** [March 10, 2025, 9:37pm UTC](https://discourse.openondemand.org/t/jupyterlmod-extension-does-not-update-pythonpath-for-jupyter-notebook/4107/1 "2025-03-10T21:37:52Z")

</div>

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:

```console
#!/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?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [March 11, 2025, 2:03pm UTC](https://discourse.openondemand.org/t/jupyterlmod-extension-does-not-update-pythonpath-for-jupyter-notebook/4107/2 "2025-03-11T14:03:14Z")

</div>

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.

> <https://github.com/cmd-ntrf/jupyter-lmod/issues/82>
>
> I am using \`JupyterLab==4.0.3\` and whenever I load/unload modules using the exte…nsion, I have updated \`$PATH\` values inside my Notebooks, however, the \`$PYTHONPATH\` variable remains unchanged. Is it an expected behaviour? How can I make sure this variable is automatically updated in my Notebooks whenever I use the extension?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [September 7, 2025, 2:04pm UTC](https://discourse.openondemand.org/t/jupyterlmod-extension-does-not-update-pythonpath-for-jupyter-notebook/4107/3 "2025-09-07T14:04:06Z")

</div>

Closed on September 7, 2025, 2:04pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
