Jupyter Lab
Jupyter Lab offers notebook editing, code running and file transfer features to make producing documented code easier.
We currently support running Julia, Python, R within notebooks. Stata and other kernels are in progress
Using your web browser, either from the OnDemand main page or via the Apps menu, select Jupyter Lab.
You will be given a choice of size of the server that will run your Jupyter Lab session. Unless you know you will be using parallel processing, you should choose 1 or 2 CPUs. Two CPUs can help keep your Jupyter session responsive and speed up file access when one CPU is busy processing your code.
Detailed user guides can be found on the Jupyter Lab website.
Adding your own kernels
Python
After creating a virtualenv or venv and activating it install the ipykernel package and run
python -m ipykernel install --name nameofenvironment --display-name "Python (nameofenvironment)" --prefix "${HOME}/.local"
When you next open JupyterLab, or after a few minutes if its already open you will find a new kernel called Python (nameofenvironment) available.
R
To use R within JupyterLab, you need to register its kernel as follows:
install.packages("IRkernel")
IRkernel::installspec(name = "nameofenvironment", displayname = "R (nameofenvironment)")
When you next open JupyterLab, or after a few minutes if its already open you will find a new kernel called R (nameofenvironment) available.
e.g.
module add apps/R/4.4.1
Rscript -e 'install.packages("IRkernel")'
Rscript -e 'IRkernel::installspec(name = "ir441", displayname = "R (4.4.1)")'
When you next open JupyterLab, or after a few minutes if its already open you will find a new kernel called R (4.4.1) available.
Using software modules
We have configured Jupyter to use the same software modules used on the cluster for running kernels (different languages or versions within Jupyter)
Click the software box extension from the Left-hand menu and choose the module(s) you need by searching e.g. for jupyter-r hovering over the result and pressing the load button
You can unload modules in a similar manner and your choice of available kernels will change to match.