Installing R Libraries Locally

While the Hummingbird team’s intent is to install R libraries in the global scope (so others may have access to them), it is sometimes not practical or feasible. In those instances, we instead recommend that users install these libraries in their own home folder as a virtual environment. In that case, the use of conda is required (and often easier).

1. Start by loading a conda environment from the module system (miniconda3.9 is the newest at this time, and thus is the preferred one to use):

module load miniconda3.9

While conda is most frequently associated with Python, it is also usable for R installations as well.

2. Next, you will need to create a virtual environment to load R and the subsequent libraries into:

conda create -n <env-name> r-essentials r-base

In the event that this is not for just you (a single user), but instead for a working group you should instead use the syntax:

conda create -p /hb/groups/<group-folder>/<env-name> r-essentials r-base

which will create the conda environment in the shared location.

3. In order to interact with the environment, it now needs to be activated via:

conda activate <env-name>

Again, if you are using a group folder, then the full path is needed:

conda activate /hb/groups/<group-folder>/<env-name>

4. Finally, to install the target libraries for R, you will need to run the command:

conda install [-c <channel-name>] <package-name>

Note that, in some cases (due to dependency-hell) it will be necessary to load multiple channels (eg conda-forge AND bioconductor, etc.). This can be easily done by just including the additional `-c <channel-name>` in the command. The <channel-name> indicates that there are packages not maintained by the official conda repository, but may be required for proper installation. If you don’t know the <channel-name>, you should refer to the installation instructions of the software package you are installing. The “conda-forge” <channel-name> is most common.

PLEASE send email to hummingbird@ucsc.edu if you encounter any unsolvable problems.

UC Santa Cruz Research Computing