How to Set Up R Kernel in JupyterLab

Article ID: 685
Last updated: 25 Mar, 2026

NAS currently supports three versions of the R machine learning platform:

  • R Versions 3.6 and 4.2 are provided in the r3_6 and r4_2 NAS conda environments, respectively.
  • R Version 4.1 and 4.2 are provided as a NAS software package.

The versions in conda come preinstalled with many of the popular R packages used in data science and machine learning, including JupyterLab. Although the version provided as a NAS software package does not include JupyterLab, you can configure JupyterLab to work with this version of R by following the instructions below.

IMPORTANT: You must run Jupyter on a node dedicated to you alone. You can do this either by running an interactive PBS session (for CPU or GPU jobs) or by reserving a dedicated compute node (for CPU jobs only). Running Jupyter on any other system, including an secure front end (SFE), Lou front end (LFE), or a non-dedicated PFE, is prohibited.

Before You Begin: Complete all the steps in the following articles:

Complete the following steps to install R and set up JupyterLab to use it:

  1. Load the following NetBSD Packages Collection (pkgsrc) module and start R (version 4.1):
    pfe25% module load pkgsrc/2022Q1-rome
    pfe25% R

    Note: A newer version of R (4.2) is available in pkgsrc/2023Q3.

  2. Install IRkernel in R:
    > install.packages("IRkernel")
  3. Run IRkernel in R:
    > IRkernel::installspec()
  4. Copy the IRkernel directory to your Jupyter data directory. For example, if your IRkernel directory is in $HOME/R/x86_64-redhat-linux-gnu-library/4.1, do:
    > cp -R $HOME/R/x86_64-redhat-linux-gnu-library/4.1/IRkernel $HOME/.local/share/jupyter
  5. Change the R path (the first "R") in the $HOME/.local/share/jupyter/IRkernel/kernelspec /kernel.json file to:
    /nasa/pkgsrc/toss4/2022Q1-rome/bin/R (or other R)
  6. Load Jupyter and run R.
Also read

Contact Us

General User Assistance

Security

  • Report security issues 24x7x365
  • Toll-free: 1-877-NASA-SEC (1-877-627-2732)
  • E-mail: soc@nasa.gov

User Documentation

High-End Computing Capability (HECC) Portfolio Office

NASA High-End Computing Program

Tell Us About It

Our goal is furnish all the information you need to efficiently and effectively use the HECC resources needed for your NASA computational projects.

We welcome your input on features and topics that you would like to see included on this website.

Please send us email with your wish list and other feedback.