FAQs

Why can't my R package be installed?

Luria has multiple versions of R available through the environment modules system. Sometimes, R packages install normally. However, other times there may be incompatibilities between the versions of R installed on Luria and the R package you're trying to install or a dependency that an R package needs is not installed on Luria.

In cases like this, you'll likely to need to use R installed some other way. There are two ways: using a Singularity image with R built-in, or installing R in a Conda environment. The first way is preferable.

Using R from Singularity

The Rocker project creates OCI images that come pre-installed with R. Each image is geared toward a specific use-case. The r-ver images can be used for when you only need the R command line. The rest of the images come pre-installed with RStudio. If you want to run RStudio, not just the R command line, refer to the following page.

Running Images in Singularity

To use one of these images, follow these instructions on Luria:

module load singularity/3.10.4

# Replace 4.2.0 with the version of R you need.
# The first time this runs, Singularity will pull
# the image, which may take around 5 - 10 minutes.
# Subsequent times will be faster.
singularity exec rocker/r-ver:4.2.0 R

# You will now have an R 4.2.0 session running. Run
# install.packages("YOUR PACKAGE") and type "y" if
# R prompts you to create a user library
R>

Using R in Conda

R is available as a package in the conda-forge channel. You can create a Conda environment, then install R into this environment.

module load miniconda3/v4

source /home/software/conda/miniconda3/bin/condainit

# Name the environment as you please
conda create --name r_environment

conda activate r_environment

# Replace 4.4.1 with the version of R you
# need. Make sure to check if conda-forge
# has the version packaged.
conda install -n conda-forge r-base::4.4.1

R

# You will now have an R 4.4.1 session running. Run
# install.packages("YOUR PACKAGE") and type "y" if
# R prompts you to create a user library
R>

Last updated

Massachusetts Institute of Technology