- Connects to RStudio Public Package Manager to provide fast binary installations of R packages on Linux.
- Complete coverage of CRAN and BioConductor packages.
- Full integration with the system package manager to resolve, download and configure system requirements automagically without leaving your R console.
- Fully user mode, no root privileges required.
- Support for CentOS / RHEL 7 and 8.
- Support for RHEL derivatives: Rocky Linux 8, AlmaLinux 8, Oracle Linux 7 and 8, Amazon Linux 2.
- Support for openSUSE / SLES 15.3.
- Support for Ubuntu 18.04, 20.04 and 22.04 (requires
Both R packages and system dependencies are installed into the user home. For lightning-fast system-based installations (which have other advantages, such as multitenancy, reversibility and automatic updates, still without root privileges), see the bspm package and projects such as cran2copr for Fedora or r2u for Ubuntu.
Here we enable
rspm and trigger a binary installation of the
units package. Then, we can see how the UDUNITS-2 dependency is detected, downloaded and configured.
You can install it directly from GitHub using the
You just need to enable it once for your session, and then you can install or update packages normally via
Packages with system requirements, like the one above, will be scanned and configured automatically. Typically, everything will just work without any further action. But if something gets misconfigured for some reason, it is possible to manually trigger a reconfiguration with the following command:
To enable it by default for all sessions, put the following into your
rspm::enable() # wrap it in suppressMessages() to suppress the initial message
To initialize an
renv project with
rspm support, just run the following:
This command runs
renv::init() for you and then installs the infrastructure required for the integration with
update.packages. Note that, if
renv::update are called directly, then
rspm::install_sysreqs() needs to be called manually.
Since always, Linux R users have been struggling with source installations and manual management of build dependencies. Several projects over the years tried to lessen this pain by building repositories of binaries that complement and scale up the offer by various distributions. See e.g. the c2d4u.team/c2d4u4.0+ PPA repo for Ubuntu or, more recently, the autoCRAN OBS repo for OpenSUSE, the iucar/cran Copr repo for Fedora, the ArchRPkgs repo for Arch and the r2u repo again for Ubuntu. These are tightly integrated and can be fully managed without leaving the R console thanks to the bspm package. See this paper for a detailed review.
On the other hand, RStudio recently took a complementary approach by building binaries—for various distributions, R versions and architectures—and serving them via their own CRAN mirror, also called the RStudio Public Package Manager (RSPM). In contrast to the previous solutions, this method allows the user to install binary packages as user packages under their home directory (virtually anywhere), instead of as system packages. The main issue is that the user has still to manage run-time system requirements themselves (i.e., shared libraries required by some packages to work), so this method by itself produces installations that are fundamentally broken.
To fill this gap, this package not only provides an easy setup of RSPM, but also monitors and scans every installation for missing system requirements, and then automatically downloads, installs and configures them, relieving the user of this task. This is done following the same complementary philosophy: everything is installed as user packages under the home directory. More specifically, this package uses the path
~/.local/share/R/rspm for this.
The main technical issue here is that libraries are search for only in a few pre-configured places that belong to the system (such as
/usr/lib), and thus we need a mechanism to feed our new user-hosted library paths to R packages, hopefully without restarting R and managing environment variables. This is achieved by automatically updating the
RPATH of every
.so binary in our user R packages. This
RPATH is an optional entry that lives in the header of ELF executables and shared libraries, and it is used by the dynamic linker as the primary search path if exists. Therefore, it is the perfect mechanism for this task, because it can be applied dynamically as new installations are made, and without requiring any special privilege.
If you find any bug or you’d like to request support for other distributions (importantly, they must be supported by RStudio), please file issues at our GitHub issue tracker. Note though that some quirks may be expected:
- Some library is not found. This means that the library version in your system is different from what RStudio had when the package was built. This is more likely to happen in derivatives (e.g. Amazon Linux) that drift away from their parent.
- Some package is installed from source. This means that RStudio has no binary version for that package.
There is nothing we can do from
rspm in either case, so please do not file issues about them. Unfortunately, the best you can do is to install the development packages for the required library and force a source installation (i.e. business as usual).
RStudio is a registered trademark of RStudio, PBC. This software provides access to a public repository maintained by RStudio and provided to the open-source community for free, but has no association with it.