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

Extension not finding my Lmod modules #17

Closed hpc-cofc closed 4 years ago

hpc-cofc commented 4 years ago

I installed the jupyter-lmod extension as described in the README file and I can see the Lmod icon in my JupyterLab interface, but it doesn't show any modules.

LMOD version=7.8.1 JupyterLab version=2.1.1

(jupyter-hub) root@host[~] env|grep -i lmod_version
LMOD_VERSION=7.8.1

(jupyter-hub) root@host[~] conda list | grep -i -e lmod -e jupyter
# packages in environment at /XYZ/anaconda/3/2020.02/envs/jupyter-hub:
jupyter-server-proxy      1.3.2                      py_0    conda-forge
jupyter_client            6.1.3                      py_0    conda-forge
jupyter_core              4.6.3            py37hc8dfbb8_1    conda-forge
jupyter_telemetry         0.0.5                      py_0    conda-forge
jupyterhub                1.1.0                    py37_2    conda-forge
jupyterhub-base           1.1.0                    py37_2    conda-forge
jupyterlab                2.1.1                      py_0    conda-forge
jupyterlab_server         1.1.1                      py_0    conda-forge
jupyterlmod               1.8.0                    pypi_0    pypi`

(jupyter-hub) root@host[~] jupyter labextension list
JupyterLab v2.1.1
Known labextensions:
   app dir: /XYZ/anaconda/3/2020.02/envs/jupyter-hub/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        @jupyterlab/fasta-extension v2.0.0  enabled  OK
        @jupyterlab/geojson-extension v2.0.1  enabled  OK
        @jupyterlab/mathjax3-extension v3.0.0  enabled  OK
        @jupyterlab/toc v3.0.0  enabled  OK
        dask-labextension v2.0.2  enabled  OK
        jupyterlab-lmod v0.6.0  enabled  OK

Screen Shot 2020-05-06 at 3 57 26 PM

What would I have to do for the Jupyter-Lmod extension to find and show my LMOD modules?

Thanks.

cmd-ntrf commented 4 years ago

It is either a client-side browser / javascript issue or a server side configuration issue.

To rule out client-side, can you look in your browser's console and see if there are error messages? If there are error messages, provide these messages and your browser version.

To rule out server side, in the address bar:

  1. replace /lab by /lmod/list -> this should display a web page with a JSON aray of the modules currently loaded (equivalent of module list)
  2. replace /lab by /lmod/avail -> this should display a web page with a JSON array of the modules available (equivalent of module av).

If one or both rest API endpoints do not return values, the jupyter-lmod extension is misconfigured.

hpc-cofc commented 4 years ago

Thanks for the quick reply. You may have helped me figure out the problem. It looks like the Lmod modules were not showing up for the local spawner, but they do show up when I use the SLURM spawner. My SLURM spawner batch script explicitly activates Lmod while the local spawner doesn't.

jupyterhub.config

c.JupyterHub.spawner_class = 'wrapspawner.ProfilesSpawner'

c.SlurmSpawner.batch_script = '''#!/bin/bash
#SBATCH -p {partition}
#SBATCH --time={runtime}
#SBATCH --nodes=1
#SBATCH --ntasks-per-node={nprocs}
#SBATCH --mem={memory}
#SBATCH --job-name=Jupyter
#SBATCH --output=/home/{username}/jupyterhub-spawner.%j.log
#SBATCH --export=ALL
#SBATCH --workdir=/home/{username}/jupyter
#SBATCH {options}

export MODULEPATH=/XYZ/modulefiles
source /XYZ/lmod/7.8.1/init/bash

module load autotools prun/1.2 gnu8/8.3.0 openmpi3/3.1.3 ohpc use.own
...
module load anaconda/3/2020.02
source activate jupyter-hub
{cmd}
'''

c.ProfilesSpawner.profiles = [
  ( 'Local ', 'local', 'jupyterhub.spawner.LocalProcessSpawner', {'ip':'0.0.0.0'} ),
  ( 'Debug- 8 cores + 32GB RAM for 2hrs', 'debug-8-2', 'batchspawner.SlurmSpawner', dict( req_partition='debugq', req_nprocs='8', req_memory='32GB', req_runtime='2:00:00'))
...
]

I may just need to find a way to activate Lmod for the local spawner.

Thanks for your help.

cmd-ntrf commented 4 years ago

Glad I could help!

shankar1729 commented 1 year ago

I'm encountering a similar issue with no modules being picked up in jupyterlab servers launched locally. Was there a specific solution to activate Lmod for the local spawner?

shankar1729 commented 1 year ago

For future reference, this needed LMOD_CMD and MODULEPATH to be defined explicitly using c.Spawner.environment in jupyterhub_config.py. (Essentially, this boiled down to the lmod setup not being sourced in the jupyterhub systemd script in a typical setup.)