{"id":14069793,"url":"https://github.com/rstudio/r-system-requirements","last_synced_at":"2025-07-02T00:02:23.526Z","repository":{"id":39852670,"uuid":"170201635","full_name":"rstudio/r-system-requirements","owner":"rstudio","description":"System requirements for R packages","archived":false,"fork":false,"pushed_at":"2025-05-23T19:56:44.000Z","size":609,"stargazers_count":132,"open_issues_count":23,"forks_count":27,"subscribers_count":26,"default_branch":"main","last_synced_at":"2025-05-23T20:38:40.610Z","etag":null,"topics":["package-manager"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-11T21:01:15.000Z","updated_at":"2025-05-23T19:56:48.000Z","dependencies_parsed_at":"2023-10-14T22:10:02.875Z","dependency_job_id":"f3566b6e-cb52-4281-9731-eccf9fa295e2","html_url":"https://github.com/rstudio/r-system-requirements","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rstudio/r-system-requirements","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-system-requirements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-system-requirements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-system-requirements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-system-requirements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstudio","download_url":"https://codeload.github.com/rstudio/r-system-requirements/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-system-requirements/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263052426,"owners_count":23406103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["package-manager"],"created_at":"2024-08-13T07:07:14.311Z","updated_at":"2025-07-02T00:02:23.403Z","avatar_url":"https://github.com/rstudio.png","language":"Shell","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"# System Requirements for R Packages\n\n[![CI Status](https://github.com/rstudio/r-system-requirements/actions/workflows/ci.yml/badge.svg)](https://github.com/rstudio/r-system-requirements/actions/workflows/ci.yml)\n\nR packages can depend on one another, but they can also depend on software\nexternal to the R ecosystem. On Ubuntu 24.04, for example, in order to install\nthe `curl` R package, you must have previously run `apt install libcurl4-openssl-dev`. R\npackages often note these dependencies in the `SystemRequirements` field within their `DESCRIPTION` files, but this\ninformation is free-form text that varies by package.\n\nThis repository contains a catalog of \"rules\" that can be used to systematically\nidentify these dependencies and generate commands to install them.\n\nYou may be expecting to see a list like:\n\n| Package | `SystemRequirements` | Dependency |\n| ------  | ----------- | ----- |\n| `curl`   | `libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb).` | `libcurl4-openssl-dev` |\n\n\nStoring this information as a table in this format is not efficient. Many R\npackages do not have any system dependencies, so the table would be very\nsparse. Moreover, R packages are added at an exponential rate, so maintaining\nthis data would be nearly impossible.\n\nInstead, this repository contains a set of rules that map a\n`SystemRequirements` field to a platform specific install command such as\n`apt install libcurl4-openssl-dev`.\n\n\n## Usage\n\nThe primary purpose of this catalog is to support [Posit Package Manager](https://posit.co/products/enterprise/package-manager/),\nwhich translates these rules into install commands for specific packages or\nrepositiories.\n\nYou can find the install commands for a package by viewing the package page in\n[Posit Public Package Manager](https://p3m.dev/), or using the [`pak`](https://pak.r-lib.org/reference/sysreqs.html)\npackage in R. `pak` will also automatically install the system requirements when installing a package.\n\nWhile Posit Package Manager is a professional product, this catalog is available as a community resource\nunder the MIT license. Please open an issue in this repository for any bugs or requests,\nor see the [For Developers](#for-developers) section for how to contribute to this repository.\n\n## Operating Systems\n\nThe rules in this catalog support the following operating systems:\n\n- Ubuntu 20.04, 22.04, 24.04\n- CentOS 7\n- Rocky Linux 8[^1], 9\n- Red Hat Enterprise Linux 7, 8, 9\n- openSUSE 15.6\n- SUSE Linux Enterprise 15 SP6\n- Debian 11, 12, unstable\n- Fedora 40, 41\n- Windows (for R 4.0+ only)\n\n[^1]: Rocky Linux 8 is specified as `centos8` for backward compatibility.\nCentOS 8 reached end of support on December 31, 2021.\n\n---\n\n## For Developers\n\nWe welcome contributions to this catalog! To report a bug or request a rule,\nplease open an issue in this repository. To add or update a rule, fork this\nrepository and submit a pull request.\n\n### Overview\n\nEach system requirement rule is described by a JSON file in the [`rules/`](rules)\ndirectory. The file is named \u003ccode\u003e\u003ci\u003erule-name\u003c/i\u003e.json\u003c/code\u003e, where\n*`rule-name`* is typically the name of the system dependency.\n\nFor example, here's an excerpt from a rule for the Protocol Buffers (protobuf)\nlibrary at [`rules/libprotobuf.json`](rules/libprotobuf.json).\n\n```js\n{\n  \"patterns\": [\"\\\\blibprotobuf\\\\b\"],  // regex which matches \"libprotobuf\" or \"LIBPROTOBUF; libxml2\"\n  \"dependencies\": [\n    {\n      \"packages\": [\"protobuf-devel\"],  // to install the package: \"yum install protobuf-devel\"\n      \"pre_install\": [\n        {\n          \"command\": \"yum install -y epel-release\"  // add the EPEL repository before installing\n        }\n      ],\n      \"constraints\": [\n        {\n          \"os\": \"linux\",\n          \"distribution\": \"centos\",  // make these instructions specific to CentOS 7\n          \"versions\": [\"7\"]\n        }\n      ]\n    }\n  ]\n}\n```\n\nOther examples:\n- Simple rule: [`git.json`](rules/git.json)\n- OS version constraints (package names vary by OS version): [`libmysqlclient.json`](rules/libmysqlclient.json)\n- Pre-install steps (adding the EPEL repo on CentOS/RHEL): [`gdal.json`](rules/gdal.json)\n- Post-install steps (reconfiguring R for Java): [`java.json`](rules/java.json)\n\n### JSON Fields\n\n```js\n{\n  \"patterns\": [...],\n  \"dependencies\": [\n    {\n      \"packages\": [...],\n      \"constraints\": [\n        {\n          \"os\": ...,\n          \"distribution\": ...,\n          \"versions\": [...]\n        }\n      ],\n      \"pre_install\": [\n        {\n          \"command\": ...,\n          \"script\": ...\n        }\n      ],\n      \"post_install\": [\n        {\n          \"command\": ...,\n          \"script\": ...\n        }\n      ]\n    }\n  ]\n}\n```\n\n#### Top-level fields\n\n| Field | Type | Description |\n| ----- | ---- | ----------- |\n| `patterns` | Array | Regular expressions to match `SystemRequirements` fields. Case-insensitive. Note that the escape character must be escaped itself (`\\\\.` to match a dot). Use word boundaries (`\\\\b`) for more accurate matches.\u003cbr/\u003eExample: `[\"\\\\bgnu make\\\\b\", \"\\\\bgmake\\\\b\"]` to match `GNU Make` or `gmake; OpenSSL` |\n| `dependencies` | Array | Rules for installing the dependency on one or more operating systems. See [dependencies](#dependencies). |\n\n#### Dependencies\n\n| Field | Type | Description |\n| ----- | ---- | ----------- |\n| `packages` | Array | Packages installed through the default system package manager (e.g. apt, yum, zypper). Examples: `[\"libxml2-dev\"]`, `[\"tcl\", \"tk\"]` |\n| `constraints` | Array | One or more operating system constraints. See [constraints](#constraints). |\n| `pre_install` | Array | Optional commands or scripts to run before installing packages (e.g. adding a third-party repository). See [pre/post-install actions](#prepost-install-actions).\n| `post_install` | Array | Optional commands or scripts to run after installing packages (e.g. cleaning up). See [pre/post-install actions](#prepost-install-actions).\n\n#### Constraints\n\n| Field | Type | Description |\n| ----- | ---- | ----------- |\n| `os` | String | Operating system. Only `\"linux\"` is supported for now. |\n| `distribution` | String | Linux distribution. One of `\"ubuntu\"`, `\"debian\"`, `\"centos\"`, `\"redhat\"`, `\"opensuse\"`, `\"sle\"`, `\"fedora\"` |\n| `versions` | Array | Optional set of OS versions. If unspecified, the rule applies to all supported versions. See [`systems.json`](systems.json) for supported values by OS. Example: `[\"24.04\"]` for Ubuntu. |\n\n#### Pre/post-install actions\n\nPre-install and post-install actions can be specified as either a `command` or\n`script`. Commands are preferred unless there's complicated logic involved.\n\n| Field | Type | Description |\n| ----- | ---- | ----------- |\n| `command` | String | A shell command. Example: `\"dnf install -y epel-release\"` |\n| `script` | String | A shell script found in the [`scripts`](scripts) directory. Example: `\"centos_epel.sh\"` |\n\n### Adding a rule\n\nA typical workflow for adding a new rule consists of:\n\n1. Come up with regular expressions to match all R packages with the system\n   dependency. See [`sysreqs.json`](test/sysreqs.json) for a sample list of\n   CRAN packages and their `SystemRequirements` fields.\n   Note that the applicable R packages don't have to be on CRAN; they can be on\n   GitHub or other repositories, such as Bioconductor and rOpenSci.\n2. Determine the system packages and any pre/post-install steps if needed.\n   The more operating systems covered, the better, but it's fine if only some\n   operating systems are covered.\n\n   Useful resources for finding packages across different OSs:\n   - https://pkgs.org\n   - https://repology.org\n\n   Or to search for packages on each OS:\n   ```sh\n   # Ubuntu/Debian\n   apt-cache search \u003cpackage-name\u003e\n\n   # CentOS/RHEL/Fedora\n   yum search \u003cpackage-name\u003e\n\n   # openSUSE/SLE\n   zypper search \u003cpackage-name\u003e\n   ```\n3. Add the new rule as a \u003ccode\u003e\u003ci\u003erule-name\u003c/i\u003e.json\u003c/code\u003e file in the `rules` directory.\n4. Run the schema tests and (optionally) the system package tests locally.\n5. Submit a pull request.\n\n### Testing\n\n#### Schema tests\n\nTo lint and validate rules against the schema, you'll need [Node.js](https://nodejs.org/).\n\n```sh\n# Install dependencies\nnpm install\n\n# Run the tests\nnpm test\n```\n\nTo list R packages and system requirements matched by a rule:\n\n```sh\n# List matching system requirements for a rule\nnpm run test-patterns -- rules/libcurl.json --verbose\n\n# List matching system requirements for all rules\nnpm run test-patterns-all -- --verbose\n\n# Fail if a rule doesn't match any system requirements\nnpm run test-patterns-all -- --strict\n```\n\nTo update the list of R packages and system requirements used for testing, run:\n\n```sh\nmake update-sysreqs\n```\n\n#### System package tests\n\n[Docker](https://www.docker.com/) images are provided to help validate system\npackages on supported OSs.\n\nAvailable tags:\n- `focal` (Ubuntu 20.04)\n- `jammy` (Ubuntu 22.04)\n- `noble` (Ubuntu 24.04)\n- `buster` (Debian 10)\n- `bullseye` (Debian 11)\n- `bookworm` (Debian 12)\n- `sid` (Debian unstable)\n- `centos7` (CentOS 7)\n- `centos8` (Rocky Linux 8)\n- `rockylinux9` (Rocky Linux 9)\n- `opensuse155` (openSUSE 15.5)\n- `fedora36` (Fedora 36)\n- `fedora37` (Fedora 37)\n- `fedora38` (Fedora 38)\n- `fedora39` (Fedora 39)\n\nTo build the images:\n\n```sh\n# Build a specific image (e.g. focal)\nmake build-focal\n\n# Build all images\nmake build-all\n```\n\nTo test the rules:\n\n```sh\n# Test a specific rule on an OS (e.g. focal)\nmake test-focal RULES=rules/libcurl.json\n\n# Test a specific rule on all OSs\nmake test-all RULES=rules/libcurl.json\n\n# Test all rules on all OSs\nmake test-all\n```\n\n### Schema\n\nThe JSON schema is defined in the file [`schema.json`](schema.json). Do not\nmodify this file directly, since it is automatically generated. Instead, modify\n`schema.template.json` and then run `npm run generate-schema`. The\n`generate-schema` target is automatically run when running `npm test`.\n\nIf you need to modify the distros and/or versions supported in the schema definitions,\nmodify [`systems.json`](systems.json).\n\n## Acknowledgements\n\nAn earlier similar [project](https://github.com/r-hub/sysreqsdb) maintained by R-Hub has been\ndeprecated in 2024 in favor of this catalog.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fr-system-requirements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstudio%2Fr-system-requirements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fr-system-requirements/lists"}