cmd-ntrf / jupyter-lmod

Jupyter plugin that provides a tab for TACC Lmod (https://github.com/TACC/Lmod)
MIT License
28 stars 13 forks source link

lmod.load from within jupyter does not behave the same as the jupyter-lmod load [aka export modules] #37

Closed surak closed 1 year ago

surak commented 3 years ago

The jupyter-lmod interface has a button which shows the following:

Export modules Add this in a notebook to load the same modules :

await lmod.purge(force=True)
await lmod.load('.....

If I understand correctly, this will fail to load python modules, as the pythonpath/ld_library_path/whatever is set on the python which is currently running, while the jupyterlab interface is "external" to this running python instance. I am not sure if I am writing in a confusing way, so I will give an example:

Ok, to reproduce:

Working example - using the sidebar interface

Non-working example: using python code

cmd-ntrf commented 3 years ago

If I understand correctly, this will fail to load python modules, as the pythonpath/ld_library_path/whatever is set on the python which is currently running, while the jupyterlab interface is "external" to this running python instance.

You are correct, although it is not related to jupyterlab interface.

The Python code generated does not interact with the JupyterLab plugin. It modifies the environment variables contained in os.environ. Child processes of the kernel will inherits these environment variables. The usefulness of this feature is fairly limited since it is not a Python API for the JupyterLab plugin, it's only the lmod api.