Enables binary package installations on Linux distributions. Provides functions to manage packages via the distribution’s package manager. Also provides transparent integration with R’s install.packages() and a fallback mechanism. When installed as a system package, interacts with the system’s package manager without requiring administrative privileges via an integrated D-Bus service; otherwise, uses sudo. Currently, the following backends are supported: DNF, APT, ALPM.
See our contributed talk at useR! 2021: [video, slides].
Installation from system repositories is preferred, mainly to avoid issues on SELinux-enabled systems (see #19).
rocker/r-bspm
images.bspm
in another distro, or you are
packaging it as a system package, please follow the general procedure
below.Installation from source requires (apart from R) the folllowing Python bindings:
Package manager | DBus (*) | GObject (*) | |
---|---|---|---|
Fedora/RedHat | python3-dnf |
python3-dbus |
python3-gobject |
Ubuntu/Debian | python3-apt |
python3-dbus |
python3-gi |
openSUSE | python3-dnf |
python38-dbus-python |
python3-gobject |
Arch | pyalpm |
python-dbus |
python-gobject |
(*) Optional, only required if you plan to run bspm
as a
regular user (non-root) in a (systemd-based) desktop/server setting.
Then, you should install bspm
as a system package to be
able to use it as a regular user. Download the latest version from CRAN
or GitHub and proceed with the installation (note
sudo
):
$ sudo R CMD INSTALL bspm_[version].tar.gz
Further configuration options:
--configure-args="--without-dbus-service"
.--configure-vars="BUILD_ROOT=[path_to_build_root]"
too.--configure-vars="PKG_PREF='prefix1- prefix2- ...'"
and
--configure-vars="PKG_EXCL='exclusion1 exclusion2 ...'"
.To enable it by default, put the following into the
Rprofile.site
:
> bspm::enable() # wrap it in suppressMessages() to avoid the initial message
Then, run install.packages
as usual, and available
system packages will be automatically installed.
There are thousands of binary packages available via the iucar/cran
Copr repo. The bspm
package is available as
R-CoprManager
, and enabled by default:
$ sudo dnf install 'dnf-command(copr)'
$ sudo dnf copr enable iucar/cran
$ sudo dnf install R-CoprManager
There are thousands of binary packages available via the c2d4u.team/c2d4u4.0+ PPA repo:
$ sudo add-apt-repository ppa:marutter/rrutter4.0 # R v4.0 and higher
$ sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+ # R packages
$ sudo apt-get update && sudo apt-get install python3-{dbus,gi,apt}
Then, install bspm
as a system package from CRAN:
$ sudo Rscript -e 'install.packages("bspm", repos="https://cran.r-project.org")'
Then, to enable it system-wide (alternatively, use your
.Rprofile
):
$ echo "bspm::enable()" | sudo tee -a /etc/R/Rprofile.site
There are thousands of binary packages available via the autoCRAN OBS repo:
$ sudo zypper ar -r https://download.opensuse.org/repositories/devel:/languages:/R:/patched/openSUSE_Tumbleweed/devel:languages:R:patched.repo
$ sudo zypper ar -r https://download.opensuse.org/repositories/devel:/languages:/R:/autoCRAN/openSUSE_Tumbleweed/devel:languages:R:autoCRAN.repo
$ sudo zypper install R-patched python3-dnf python38-dbus-python python3-gobject
$ sudo ln -s /etc/zypp/repos.d /etc/yum.repos.d
Then, install bspm
as a system package from CRAN:
$ sudo Rscript -e 'install.packages("bspm", repos="https://cran.r-project.org")'
Then, to enable it system-wide (alternatively, use your
.Rprofile
):
$ echo "bspm::enable()" | sudo tee -a /usr/lib64/R/etc/Rprofile.site
Sometimes, a restart is required so that the new systemd service is recognized.
There are a number of binary CRAN packages available via the ArchRPkgs repo as well as Bioconductor packages via the BioArchLinux repo:
$ echo -e "\n[desolve]\nServer = https://desolve.ru/archrepo/\$arch" \
"\n[BioArchLinux]\nServer = https://repo.bioarchlinux.org/\$arch" \
| sudo tee -a /etc/pacman.conf
$ sudo pacman -Sy && sudo pacman -S r pyalpm python-{dbus,gobject}
Then, install bspm
as a system package from CRAN:
$ sudo Rscript -e 'install.packages("bspm", repos="https://cran.r-project.org")'
Then, to enable it system-wide (alternatively, use your
.Rprofile
):
$ echo "bspm::enable()" | sudo tee -a /usr/lib64/R/etc/Rprofile.site
New backends for other package managers can be added to
inst/service/backend
. Each backend must implement the
following functions:
def discover() -> dict({ "prefixes" : list, "exclusions" : list })
def install(prefixes : list, pkgs : list, exclusions : list) -> list
def remove(prefixes : list, pkgs : list, exclusions : list) -> list
The last two functions receive a list of prefixes, a list of R package names and a list of exclusions, and must return a list with those package names that could not be processed (i.e., packages not found in the system repos). Any progress should be reported to stdout.
If you are experiencing an issue that is not listed here, or the solution did not work for you, please do not hesitate to open a ticket at our GitHub issue tracker.
Symptom: you tried to install a package and you got this message.
> install.packages(<some_package>)
in install.packages : cannot connect to the system package manager Error
This usually happens when bspm
was installed in the user
library or, as a system package, it is not properly configured for some
reason. The solution is:
bspm
in your user library.$ sudo Rscript --vanilla -e 'install.packages("bspm", repos="https://cran.r-project.org")'