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

Error loading server extension jupyterlmod #41

Closed zainul1114 closed 1 year ago

zainul1114 commented 3 years ago

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

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 "<frozen importlib._bootstrap>", line 994, in _gcd_import
Sep  1 11:41:15 master jupyterhub: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
Sep  1 11:41:15 master jupyterhub: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
Sep  1 11:41:15 master jupyterhub: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
Sep  1 11:41:15 master jupyterhub: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
Sep  1 11:41:15 master jupyterhub: File "<frozen importlib._bootstrap>", 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 <module>
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 <module>
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 <module>
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

cmd-ntrf commented 3 years ago

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?

hibozzy18 commented 3 years ago

In my configuration I used c.Spawner.environment setting

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