jupyter-lmod icon indicating copy to clipboard operation
jupyter-lmod copied to clipboard

Error loading server extension jupyterlmod

Open zainul1114 opened this issue 3 years ago • 2 comments

Hi, Please help us to resolve the issue, eventhough jupyter-serverextension is OK, i am getting this issue.

[root@master jupyterhub]# jupyter-labextension list
JupyterLab v2.2.0
Known labextensions:
   app dir: /share/apps/platform/ai/python_versions/python3/3_6_8/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        @jupyterlab/github v2.0.0  enabled  OK
        jupyterlab-control v1.1.1  enabled  OK
        jupyterlab-drawio v0.7.0  enabled  OK
        jupyterlab-lmod v0.8.1  enabled  OK
        jupyterlab-logout v0.5.0  enabled  OK
        jupyterlab-python-file v0.4.0  enabled  OK
        jupyterlab-topbar-extension v0.5.0  enabled  OK

[root@master jupyterhub]# jupyter-serverextension list config dir: /share/apps/platform/ai/python_versions/python3/3_6_8/etc/jupyter jupyterlab enabled - Validating... jupyterlab 2.2.0 OK jupyterlmod enabled - Validating... jupyterlmod OK nbresuse enabled - Validating... nbresuse OK [root@master jupyterhub]#

and i have added below code with respect to the jupyterhub_lmod on  jupyterhub_config.py

c.Spawner.env_keep = [ 'LMOD_CMD', 'MODULEPATH' 'PATH' 'PYTHONPATH', 'CONDA_ROOT', 'CONDA_DEFAULT_ENV', 'VIRTUAL_ENV', 'LANG', 'LC_ALL', 'JUPYTERHUB_SINGLEUSER_APP', ]


Logs:

Sep 1 11:41:15 master jupyterhub: [I 2021-09-01 11:41:15.662 SingleUserNotebookApp extension:162] JupyterLab extension loaded from /share/apps/platform/ai/python_versions/python3/3_6_8/lib/python3.6/site-packages/jupyterlab Sep 1 11:41:15 master jupyterhub: [I 2021-09-01 11:41:15.663 SingleUserNotebookApp extension:163] JupyterLab application directory is /share/apps/platform/ai/python_versions/python3/3_6_8/share/jupyter/lab Sep 1 11:41:15 master jupyterhub: [W 2021-09-01 11:41:15.674 SingleUserNotebookApp notebookapp:1950] Error loading server extension jupyterlmod Sep 1 11:41:15 master jupyterhub: Traceback (most recent call last): Sep 1 11:41:15 master jupyterhub: File "/share/apps/platform/ai/python_versions/python3/3_6_8/lib/python3.6/site-packages/notebook/notebookapp.py", line 1942, in init_server_extensions Sep 1 11:41:15 master jupyterhub: mod = importlib.import_module(modulename) Sep 1 11:41:15 master jupyterhub: File "/share/apps/platform/ai/python_versions/python3/3_6_8/lib/python3.6/importlib/init.py", line 126, in import_module Sep 1 11:41:15 master jupyterhub: return _bootstrap._gcd_import(name[level:], package, level) Sep 1 11:41:15 master jupyterhub: File "", line 994, in _gcd_import Sep 1 11:41:15 master jupyterhub: File "", line 971, in _find_and_load Sep 1 11:41:15 master jupyterhub: File "", line 955, in _find_and_load_unlocked Sep 1 11:41:15 master jupyterhub: File "", line 665, in _load_unlocked Sep 1 11:41:15 master jupyterhub: File "", line 678, in exec_module Sep 1 11:41:15 master jupyterhub: File "", line 219, in _call_with_frames_removed Sep 1 11:41:15 master jupyterhub: File "/share/apps/platform/ai/python_versions/python3/3_6_8/lib/python3.6/site-packages/jupyterlmod/init.py", line 3, in Sep 1 11:41:15 master jupyterhub: from . import handler Sep 1 11:41:15 master jupyterhub: File "/share/apps/platform/ai/python_versions/python3/3_6_8/lib/python3.6/site-packages/jupyterlmod/handler.py", line 4, in Sep 1 11:41:15 master jupyterhub: import lmod Sep 1 11:41:15 master jupyterhub: File "/share/apps/platform/ai/python_versions/python3/3_6_8/lib/python3.6/site-packages/lmod/init.py", line 11, in Sep 1 11:41:15 master jupyterhub: LMOD_CMD = os.environ["LMOD_CMD"] Sep 1 11:41:15 master jupyterhub: File "/share/apps/platform/ai/python_versions/python3/3_6_8/lib/python3.6/os.py", line 669, in getitem Sep 1 11:41:15 master jupyterhub: raise KeyError(key) from None Sep 1 11:41:15 master jupyterhub: KeyError: 'LMOD_CMD' Sep 1 11:41:15 master jupyterhub: [I 2021-09-01 11:41:15.729 SingleUserNotebookApp singleuser:561] Starting jupyterhub-singleuser server version 1.1.0 Sep 1 11:41:15 master jupyterhub: [I 2021-09-01 11:41:15.734 SingleUserNotebookApp log:174] 302 GET /user/zain/ -> /user/zain/lab? (@127.0.0.1) 2.42ms

Regards,
zain

zainul1114 avatar Sep 01 '21 06:09 zainul1114

The value of LMOD_CMD is not defined when the notebook is launched.

Sep  1 11:41:15 master jupyterhub: KeyError: 'LMOD_CMD'

Is it correctly defined when you launch the JupyterHub service?

cmd-ntrf avatar Sep 01 '21 12:09 cmd-ntrf

In my configuration I used c.Spawner.environment setting

c.Spawner.environment = {'LMOD_CMD' : '/path/to/lmod', 'MODULEPATH' : '/path/to/modulepath'}

hibozzy18 avatar Sep 20 '21 15:09 hibozzy18