Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

System requirements for R packages

License

NotificationsYou must be signed in to change notification settings

rstudio/r-system-requirements

Repository files navigation

CI Status

R packages can depend on one another, but they can also depend on softwareexternal to the R ecosystem. On Ubuntu 24.04, for example, in order to installthecurl R package, you must have previously runapt install libcurl4-openssl-dev. Rpackages often note these dependencies in theSystemRequirements field within theirDESCRIPTION files, but thisinformation is free-form text that varies by package.

This repository contains a catalog of "rules" that can be used to systematicallyidentify these dependencies and generate commands to install them.

You may be expecting to see a list like:

PackageSystemRequirementsDependency
curllibcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb).libcurl4-openssl-dev

Storing this information as a table in this format is not efficient. Many Rpackages do not have any system dependencies, so the table would be verysparse. Moreover, R packages are added at an exponential rate, so maintainingthis data would be nearly impossible.

Instead, this repository contains a set of rules that map aSystemRequirements field to a platform specific install command such asapt install libcurl4-openssl-dev.

Usage

The primary purpose of this catalog is to supportPosit Package Manager,which translates these rules into install commands for specific packages orrepositiories.

You can find the install commands for a package by viewing the package page inPosit Public Package Manager, or using thepakpackage in R.pak will also automatically install the system requirements when installing a package.

While Posit Package Manager is a professional product, this catalog is available as a community resourceunder the MIT license. Please open an issue in this repository for any bugs or requests,or see theFor Developers section for how to contribute to this repository.

Operating Systems

The rules in this catalog support the following operating systems:

  • Ubuntu 20.04, 22.04, 24.04
  • CentOS 7
  • Rocky Linux 81, 9
  • Red Hat Enterprise Linux 7, 8, 9
  • openSUSE 15.6
  • SUSE Linux Enterprise 15 SP6
  • Debian 12, unstable
  • Fedora 41
  • Windows (for R 4.0-4.1 only)

For Developers

We welcome contributions to this catalog! To report a bug or request a rule,please open an issue in this repository. To add or update a rule, fork thisrepository and submit a pull request.

Overview

Each system requirement rule is described by a JSON file in therules/directory. The file is namedrule-name.json, whererule-name is typically the name of the system dependency.

For example, here's an excerpt from a rule for the Protocol Buffers (protobuf)library atrules/libprotobuf.json.

{"patterns":["\\blibprotobuf\\b"],// regex which matches "libprotobuf" or "LIBPROTOBUF; libxml2""dependencies":[{"packages":["protobuf-devel"],// to install the package: "yum install protobuf-devel""pre_install":[{"command":"yum install -y epel-release"// add the EPEL repository before installing}],"constraints":[{"os":"linux","distribution":"centos",// make these instructions specific to CentOS 7"versions":["7"]}]}]}

Other examples:

JSON Fields

{"patterns":[...],"dependencies":[{"packages":[...],"constraints":[{"os": ...,"distribution": ...,"versions":[...]}],"pre_install":[{"command": ...,"script": ...}],"post_install":[{"command": ...,"script": ...}]}]}

Top-level fields

FieldTypeDescription
patternsArrayRegular expressions to matchSystemRequirements fields. Case-insensitive. Note that the escape character must be escaped itself (\\. to match a dot). Use word boundaries (\\b) for more accurate matches.
Example:["\\bgnu make\\b", "\\bgmake\\b"] to matchGNU Make orgmake; OpenSSL
dependenciesArrayRules for installing the dependency on one or more operating systems. Seedependencies.

Dependencies

FieldTypeDescription
packagesArrayPackages installed through the default system package manager (e.g. apt, yum, zypper). Examples:["libxml2-dev"],["tcl", "tk"]
constraintsArrayOne or more operating system constraints. Seeconstraints.
pre_installArrayOptional commands or scripts to run before installing packages (e.g. adding a third-party repository). Seepre/post-install actions.
post_installArrayOptional commands or scripts to run after installing packages (e.g. cleaning up). Seepre/post-install actions.

Constraints

FieldTypeDescription
osStringOperating system. Only"linux" is supported for now.
distributionStringLinux distribution. One of"ubuntu","debian","centos","redhat","opensuse","sle","fedora"
versionsArrayOptional set of OS versions. If unspecified, the rule applies to all supported versions. Seesystems.json for supported values by OS. Example:["24.04"] for Ubuntu.

Pre/post-install actions

Pre-install and post-install actions can be specified as either acommand orscript. Commands are preferred unless there's complicated logic involved.

FieldTypeDescription
commandStringA shell command. Example:"dnf install -y epel-release"
scriptStringA shell script found in thescripts directory. Example:"centos_epel.sh"

Adding a rule

A typical workflow for adding a new rule consists of:

  1. Come up with regular expressions to match all R packages with the systemdependency. Seesysreqs.json for a sample list ofCRAN packages and theirSystemRequirements fields.Note that the applicable R packages don't have to be on CRAN; they can be onGitHub or other repositories, such as Bioconductor and rOpenSci.

  2. Determine the system packages and any pre/post-install steps if needed.The more operating systems covered, the better, but it's fine if only someoperating systems are covered.

    Useful resources for finding packages across different OSs:

    Or to search for packages on each OS:

    # Ubuntu/Debianapt-cache search<package-name># CentOS/RHEL/Fedorayum search<package-name># openSUSE/SLEzypper search<package-name>
  3. Add the new rule as arule-name.json file in therules directory.

  4. Run the schema tests and (optionally) the system package tests locally.

  5. Submit a pull request.

Testing

Schema tests

To lint and validate rules against the schema, you'll needNode.js.

# Install dependenciesnpm install# Run the testsnpmtest

To list R packages and system requirements matched by a rule:

# List matching system requirements for a rulenpm run test-patterns -- rules/libcurl.json --verbose# List matching system requirements for all rulesnpm run test-patterns-all -- --verbose# Fail if a rule doesn't match any system requirementsnpm run test-patterns-all -- --strict

To update the list of R packages and system requirements used for testing, run:

make update-sysreqs

System package tests

Docker images are provided to help validate systempackages on supported OSs.

Available tags:

  • focal (Ubuntu 20.04)
  • jammy (Ubuntu 22.04)
  • noble (Ubuntu 24.04)
  • bookworm (Debian 12)
  • sid (Debian unstable)
  • centos7 (CentOS 7)
  • centos8 (Rocky Linux 8)
  • rockylinux9 (Rocky Linux 9)
  • opensuse156 (openSUSE 15.6)
  • fedora41 (Fedora 41)

To build the images:

# Build a specific image (e.g. noble)make build-noble# Build all imagesmake build-all

To test the rules:

# Test a specific rule on an OS (e.g. noble)make test-noble RULES=rules/libcurl.json# Test a specific rule on all OSsmake test-all RULES=rules/libcurl.json# Test all rules on all OSsmake test-all

Schema

The JSON schema is defined in the fileschema.json. Do notmodify this file directly, since it is automatically generated. Instead, modifyschema.template.json and then runnpm run generate-schema. Thegenerate-schema target is automatically run when runningnpm test.

If you need to modify the distros and/or versions supported in the schema definitions,modifysystems.json.

Acknowledgements

An earlier similarproject maintained by R-Hub has beendeprecated in 2024 in favor of this catalog.

Footnotes

  1. Rocky Linux 8 is specified ascentos8 for backward compatibility.CentOS 8 reached end of support on December 31, 2021.

About

System requirements for R packages

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors32


[8]ページ先頭

©2009-2025 Movatter.jp