MyNixOS website logo
Description

'RStudio' Package Manager.

Enables binary package installations on Linux distributions. Provides access to 'RStudio' public repositories at <https://packagemanager.posit.co>, and transparent management of system requirements without administrative privileges. Currently supported distributions are 'CentOS' / 'RHEL' 7-9, and several 'RHEL' derivatives ('Rocky Linux', 'AlmaLinux', 'Oracle Linux', and 'Amazon Linux'), 'openSUSE' / 'SLES' 15.4-5, 'Debian' 11-12, and 'Ubuntu' LTS 20-22.

rspm: RStudio Package Manager

Build Status CRAN_Status_Badge

Key features

  • 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, 8 and 9.
  • Support for RHEL derivatives: Rocky Linux 8-9, AlmaLinux 8-9, Oracle Linux 7-9, Amazon Linux 2-2023.
  • Support for openSUSE / SLES 15.4 and 15.5.
  • Support for Debian 11 and 12 (requires apt-file).
  • Support for Ubuntu 20.04 and 22.04 (requires apt-file).

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.

Demo

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.

Installation and usage

You can install it directly from GitHub using the remotes package:

remotes::install_github("cran4linux/rspm")

Basic usage

You just need to enable it once for your session, and then you can install or update packages normally via install.packages or update.packages.

rspm::enable()
install.packages("units")

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:

rspm::install_sysreqs()

To enable it by default for all sessions, put the following into your .Rprofile:

rspm::enable() # wrap it in suppressMessages() to suppress the initial message

{renv} projects

To initialize an renv project with rspm support, just run the following:

rspm::renv_init()

This command runs renv::init() for you and then installs the infrastructure required for the integration with install.packages and update.packages. Note that, if renv::install or renv::update are called directly, then rspm::install_sysreqs() needs to be called manually.

Docker workflows

In Docker containers, system requirements can be installed directly as root. Therefore, it is enough to include in your Dockerfile the following line right after renv::restore():

RUN Rscript -e 'renv::install("rspm"); rspm::install_sysreqs()'

Technical details

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.

Support

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).

Disclaimer

RStudio is a registered trademark of Posit. 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.

Metadata

Version

0.6.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows