{"id":14066782,"url":"https://github.com/eddelbuettel/r2u","last_synced_at":"2025-04-10T01:10:46.438Z","repository":{"id":39664444,"uuid":"480156858","full_name":"eddelbuettel/r2u","owner":"eddelbuettel","description":"CRAN as Ubuntu Binaries","archived":false,"fork":false,"pushed_at":"2025-03-26T14:39:49.000Z","size":15312,"stargazers_count":276,"open_issues_count":0,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T01:10:37.194Z","etag":null,"topics":["cran","lts","packages","r","ubuntu"],"latest_commit_sha":null,"homepage":"https://eddelbuettel.github.io/r2u","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddelbuettel.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-04-10T22:36:12.000Z","updated_at":"2025-04-02T20:22:05.000Z","dependencies_parsed_at":"2024-02-12T17:39:48.269Z","dependency_job_id":"6df69717-1e96-426c-9c98-4f1fa6782919","html_url":"https://github.com/eddelbuettel/r2u","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Fr2u","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Fr2u/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Fr2u/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Fr2u/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddelbuettel","download_url":"https://codeload.github.com/eddelbuettel/r2u/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137886,"owners_count":21053775,"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":["cran","lts","packages","r","ubuntu"],"created_at":"2024-08-13T07:05:15.598Z","updated_at":"2025-04-10T01:10:46.421Z","avatar_url":"https://github.com/eddelbuettel.png","language":"R","funding_links":["https://github.com/sponsors/eddelbuettel"],"categories":["R"],"sub_categories":[],"readme":"\n## r2u: CRAN as Ubuntu Binaries\n\n### Key features\n\n- **Full integration with `apt`** as every binary resolves _all_ its dependencies: No more\n  installations (of pre-built archives) only to discover that a shared library is missing. No more\n  surprises.\n\n- **Full integration with `apt`** so that an update of a system library cannot break an R package:\n  if a (shared) library is used by a CRAN, the package manager knows, and will not remove it.  No\n  more (R package) breakage from (system) library updates.\n\n- **Simpler and lighter** than some alternatives as only _run-time_ library packages are installed as\n  dependencies (instead of generally heavier _development_ packages).\n\n- **Installations are fast, automated and reversible** thanks to the package management layer.\n\n- **Fast and well-connected mirror** at\n  [r2u.stat.illinois.edu](https://r2u.stat.illinois.edu) on the [Internet2](https://internet2.edu/) \n\n- **Complete coverage** with (currently, using 22.04) ~ 24491 CRAN packages (and 435 from\n  BioConductor) using **current versions**: We use R 4.4.*, and BioConductor 3.20.\n\n- Complete support for **Ubuntu 20.04 (\"focal\")**, **22.04 (\"jammy\")** and **24.04 (\"noble\")** on\n  amd64, as well as (initial) **24.04 (\"noble\")** support on arm64.\n\n- Optional (but recommended) [bspm](https://cloud.r-project.org/package=bspm) use\n  **automagically connects R functions like `install.packages()` to `apt`** for access to binaries \n  _and_ dependencies.\n  \n- **Docker containers** `rocker/r2u` from the [Rocker Project](https://rocker-project.org/) for both \n  'focal', 'jammy' and 'noble'.\n  \n- **GitHub Actions support** to set up on Ubuntu 'latest' or via container.\n\n### Brief Demo\n\nThe gif below shows how _one `install.packages(\"tidyverse\")` command_ on an Ubuntu\n20.04 system _installs all packages and dependencies as binaries in 18 seconds_ (by passing the\nR package installation to `apt` using [bspm](https://cloud.r-project.org/package=bspm)).\n\n![](https://eddelbuettel.github.io/r2u/assets/tidyverse_from_r2u_2022-05-04_17-09.gif)\n\nThis uses the Docker container referenced below, which has been set up with\nthe five easy setup steps detailed here.\n\n\n### What is Covered ?\n\nWe generally support amd64 (_i.e._ standard 64-bit Intel/AMD cpus, sometimes also called x86_64) for\nthe current Ubuntu LTS release and its predecessor release (more on this\n[here](https://eddelbuettel.github.io/r2u/vignettes/FAQ/#what-about-other-architectures-besides-x86_64)).\nWe use 'r-release' just like CRAN. So currently the 'focal' 20.04 LTS, 'jammy' 22.04 LTS and 'noble'\n24.04 releases are fully supported.  We are now also starting to support arm64 on 'noble' 24.04 taking\nadvantage of arm64-based runners at GitHub Actions. \n\nSupport for additional cpu architectures is certainly possible but somewhat unlikely due to a lack of\n(additional hardware) resources and time. Support for other distributions is possible but unlikely\nright now (due to a lack of resources and time). P3M/PPM/RSPM now appears to also support Debian which\ncould be added at some later point.\n\nCurrent versions are based on R 4.4.*, and BioConductor release 3.20 packages are provided when\nrequired by CRAN packages.  Binaries are generally R 4.4.* based. Some older packages released when\nwe used R 4.2.* or 4.3.* may have been built with R 4.2.* or R 4.3.*, they will still work the same\nwith R 4.4.* as R is generally forward-compatible.\n\n\n### What is Selected ?\n\nEverything :)\n\nInitially, we started from [cran-logs](https://cran-logs.rstudio.com/) by picking the _N_\nmost-downloaded packages, along with their dependencies from BioConductor.  (It should be noted that\nfor example the first 100 packages already account for approximately half the total downloads: it is\na very skewed distribution.) We iterated, and fairly soon arrived of full coverage of CRAN.\n\nSo we now cover\n\n- *all CRAN packages* (modulo at best a handful of blacklisted ones) including all packages needing\n  compilation\n- all BioConductor packages implied by these plus a 'healthy subset' of the highest\n    [scoring](https://bioconductor.org/packages/stats/bioc/bioc_pkg_scores.tab) BioConductor\n    packages (also covering _e.g._ all BioConductor packages in the Debian and Ubuntu distributions)\n\nThis currently results in 24797, 24717, 22376 binary packages from CRAN in \"focal\", \"jammy\", and\n\"noble\", respectively, and 429, 437, and 451 BioConductor packages, respectively, from the 3.20 \nreleases. (See this\n[FAQ](https://eddelbuettel.github.io/r2u/vignettes/FAQ/#why-does-it-have-more-packages-than-cran)\nabout why this number is higher than CRAN, and variable between releases.)\n\nThe sole exception are packages we cannot build (as we do not have the required commercial software\nit accessess, or do not have the required more recent toolchain component) plus a handful or so of\n'odd builds' that fail and are skipped.\n\n### What is it Based On?\n\nFor the CRAN binaries we either repackage\n[P3M/RSPM/PPM](https://packagemanager.rstudio.com/client/#/repos/2/packages/) builds (where\navailable) or build natively. All selected BioConductor packages are built natively.  For all of\nthese, full dependency resolution and integration with the system is a key feature.\n\nEverything is provided as `.deb` binary files with proper dependency\nresolution by using a proper `apt` repo which also has a signed Release file.\n\n\n### Usage and Setup\n\n(Note that you could use one of the scripts\n[`add_cranapt_noble.sh`](https://github.com/eddelbuettel/r2u/blob/master/inst/scripts/add_cranapt_noble.sh)\n(for Ubuntu 24.04), or\n[`add_cranapt_jammy.sh`](https://github.com/eddelbuettel/r2u/blob/master/inst/scripts/add_cranapt_jammy.sh)\n(for Ubuntu 22.04), or\n[`add_cranapt_focal.sh`](https://github.com/eddelbuettel/r2u/blob/master/inst/scripts/add_cranapt_focal.sh)\n(for the older Ubuntu 20.04) to facilitate the setup. They are tested on 'empty' Ubuntu containers\nof the corresponding release. However, you may prefer to execute the steps outlined here by hand.)\nYou can use `lsb_release -cs` to generate your release name: \"focal\", \"jammy\", and \"noble\" are\nsupported and you could swap \"focal\" or \"noble\" in below (or use one of the scripts).\n\nHere, we show the setup step by step for 'jammy' aka Ubuntu 22.04 (as it is still the most-widely\nused distribution per our logs, though we may update this to 24.04 soon). You should run all these\ncommands as `root` to carefully review each one. If you prefer the newer Ubuntu 24.04, please see\nthe\n[`add_cranapt_noble.sh`](https://github.com/eddelbuettel/r2u/blob/master/inst/scripts/add_cranapt_noble.sh)\nscript which also avoids the now-deprecated `apt-key` command).\n\n\n**Step 1: Update apt, install tools, fetch key**\n\nFirst add the repository key so that `apt` knows it (this is optional but recommended)\n\n```sh\napt update -qq \u0026\u0026 apt install --yes --no-install-recommends wget \\\n    ca-certificates gnupg\nwget -q -O- https://eddelbuettel.github.io/r2u/assets/dirk_eddelbuettel_key.asc \\\n    | tee -a /etc/apt/trusted.gpg.d/cranapt_key.asc\n```\n\n**Step 2: Add the apt repo**\n\nSecond, add the repository to the `apt` registry. We recommend the well-connected main mirror\nprovide at University of Illinois:\n\n```sh\necho \"deb [arch=amd64] https://r2u.stat.illinois.edu/ubuntu jammy main\" \\\n     \u003e /etc/apt/sources.list.d/cranapt.list\napt update -qq\n```\n\nUse `arch=arm64` for arm64 support (currently only available for noble).\n\n**Step 3: Ensure you have current R binaries (optional)**\n\nThird, and optionally, if you do not yet have the current R version, run these two lines (or\nuse the [standard CRAN repo setup](https://cloud.r-project.org/bin/linux/ubuntu/))\n\n```sh\nwget -q -O- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc \\\n    | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc\necho \"deb [arch=amd64] https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/\" \\\n    \u003e /etc/apt/sources.list.d/cran_r.list\napt-key adv --keyserver keyserver.ubuntu.com --recv-keys \\\n    67C2D66C4B1D4339 51716619E084DAB9\napt update -qq\nDEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends \\\n    r-base-core\n```\n\nUse `arch=arm64` for arm64 support (currently only available for noble).\n\n\n**Step 4: Use pinning for the r2u repo (optional)**\n\nFourth, add repository 'pinning' as `apt` might get confused by some older\npackages (in the Ubuntu distro) which accidentally appear with a higher\nversion number. See the next section for a short discussion how it ensures 'CRANapt' \nsorts highest.\n\n```sh\necho \"Package: *\" \u003e /etc/apt/preferences.d/99cranapt\necho \"Pin: release o=CRAN-Apt Project\" \u003e\u003e /etc/apt/preferences.d/99cranapt\necho \"Pin: release l=CRAN-Apt Packages\" \u003e\u003e /etc/apt/preferences.d/99cranapt\necho \"Pin-Priority: 700\"  \u003e\u003e /etc/apt/preferences.d/99cranapt\n```\n\nAfter that the package are known (under their `r-cran-*` and `r-bioc-*`\nnames).  You can install them on the command-line using `apt` and `apt-get`,\nvia `aptitude` as well as other front-ends.\n\n**Step 5: Use `bspm` (optional)**\n\nFifth, and also optional, install and enable the [bspm](https://cloud.r-project.org/package=bspm)\npackage so that the r2u (or CRANapt) as well as other R packages (available as `r-*.deb` binaries)\nbecome available via `install.packages()` and `update.packages()`. Note that you may need to install\nit directly from source via `sudo Rscript -e 'install.packages(\"bspm\")'` to ensure it integrates\ncorrectly with the packaging system.  You should also install Python components used internally by\n[bspm](https://cloud.r-project.org/package=bspm) via the `sudo apt-get install\npython3-{dbus,gi,apt}` command.\n\n```sh\napt install --yes --no-install-recommends python3-{dbus,gi,apt}\n## Then install bspm (as root) and enable it, and enable a speed optimization\nRscript -e 'install.packages(\"bspm\")'\nRHOME=$(R RHOME)\necho \"suppressMessages(bspm::enable())\" \u003e\u003e ${RHOME}/etc/Rprofile.site\necho \"options(bspm.version.check=FALSE)\" \u003e\u003e ${RHOME}/etc/Rprofile.site\n```\n\nThat's it! Now try it out!\n\n\n### About Pinning\n\nPackages can be found in different repositories, and _generally_ the highest available version is\nthe one we what---and `apt` picks it for us. Now, because we let `apt` (and related tools) pick the\npackages based on versions, we may want to ensure that the CRANapt repo sorts higher than the\ndefault repo as (older) package builds in the distribution itself may appear (to `apt`) to be newer\nvia a quirk in the sorting algorithm. A case in point was package `gtable` whose version in Ubuntu\nwas `0.3.0+dfsg-1` which accidentally sorts higher than the rebuild we made under a newer and more\nconsistent version number `0.3.0-1.ca2004.1`.\n\nFor this issue, one possible and popular fix is to use 'apt pinning'. It can give 'higher weight'\nto packages from a particular repositor or tag.  In the suggested example above, we\ngive the r2u / cranapt repo a weight of 700 which is higher than the package default value of\n500.\n\n\n\n### Docker\n\n**Core r2u Containers**\n\nThere are also Docker containers for Ubuntu 20.04 'focal', 22.04 'jammy', and 24.04 'noble',\nrespectively.  Initially published as\n[eddelbuettel/r2u](https://hub.docker.com/repository/docker/eddelbuettel/r2u), these are now also\navailable also as [rocker/r2u](https://github.com/rocker-org/r2u). They all have the features\ndetailed above, including pinning and [bspm](https://cran.r-project.org/package=bspm) support,\nalready set up.\n\nEach of the Ubuntu LTS flavors, _i.e._, 'focal' and 'jammy' is also available as an identical image\nusing the release version, _i.e._, '20.04', '22.04', and '24.04', respectively.\n\nNote that with some builds of Docker (and possibly related to Ubuntu hosts) you may have to add\nthe `--security-opt seccomp=unconfined` option to your Docker invocation to take advantage of bspm\nand the full system integration inside the container.\nThis is also documented in the [FAQ](https://eddelbuettel.github.io/r2u/vignettes/FAQ/).\n\n**Contributed Containers**\n\nWe are now starting to see derived containers:\n\n- [BioConductor](https://www.bioconductor.org/) has an (alpha release) project\n[bioc2u](https://github.com/Bioconductor/bioc2u) providing (internal ?) BioConductor builds\n- [Jeffrey Girard](https://github.com/jmgirard) created\n[rstudio2u](https://github.com/jmgirard/rstudio2u) which adds RStudio to the\nbase layer provided by r2u.\n\nIt is encouraging to see such specialisations based off r2u itself.\n\n\n### GitHub Actions\n\nThere are two basic ways to take advantage of *r2u* in a GitHub Actions.  The first, and simplest,\nis to switch to using the Docker container (see previous section). This is as simple as adding the\n`container:` statement after `runs-on:` in `jobs:` section:\n\n```\n    runs-on: ubuntu-latest\n    container:\n      image: rocker/r2u:22.04\n```\n\nA complete example is provided in [this R package\nrepo](https://github.com/eddelbuettel/RcppInt64/blob/master/.github/workflows/r2u.yaml). The key\nadvantage of this approach is that everything is already set up.\n\nA second approach consists of adding *r2u* as a step via [the `r2u-setup` GitHub\nAction](https://github.com/eddelbuettel/github-actions):\n\n```\n      - name: Setup r2u\n        uses: eddelbuettel/github-actions/r2u-setup@master\n```\n\nA complete example is provided [in this\nrepo](https://github.com/eddelbuettel/spotifytop50us/blob/master/.github/workflows/update.yaml)\nwhere we use it because using the Docker container approach makes committing back via `git` a little\nharder.\n\n### Try It\n\n**Via codespaces**\n\nSee the vignette [Codespaces](https://eddelbuettel.github.io/r2u/vignettes/Codespaces/) about how to\nlaunch a 'Codespace' directly in your browser, launched from the gitrepo within minutes.\n\nThis also works from your [vscode](https://code.visualstudio.com/) installation as a remote\ncodespace.\n\nThe vignette has more details.\n\n**Via gitpod.io**\n\nUse this link below (after possibly signing up for\n[gitpod.io](https://gitpod.io/) first)\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/eddelbuettel/r2u)\n\nand run [one of the three example\nscripts](https://github.com/eddelbuettel/r2u/tree/master/inst/examples), or\njust start R in the terminal window.\n\n![](https://eddelbuettel.github.io/r2u/assets/gitpod_brms_2022-05-08_11-21.gif)\n\nThe gif below display running one such example to install\n[brms](https://github.com/paul-buerkner/brms) from binaries in a few seconds.  Using this requires\nonly (free) [GitHub](https://github.com) and [GitPod](https://gitpod.io) accounts.\n\n### Usage Statistics\n\nUsage is vibrant.  As of March 2025, over 400,000 packages are shipped per week, with a total of\nnow over thirty seven million packages shipped.  Early September 2023 also had the most recent and\ndramatic spike of _over three million packages in two days_.  The following chart gives a summary of\ncumulative and average weekly downloads (the latter one on a log scale) as of August.\n\n![](https://eddelbuettel.github.io/images/2025-03-11/r2u_aggregated_and_weekly_2025-03-11.png)\n\n### Support\n\nPlease file issues at the [GitHub issues for r2u](https://github.com/eddelbuettel/r2u/issues).\n\n\n### Frequently Asked Questions\n\nPlease also see the [FAQ](https://eddelbuettel.github.io/r2u/vignettes/FAQ/) for answers to\n_Frequently Asked Questions_.\n\n\n### Known Issues\n\n- The littler package reflects build-time configuration, the RSPM/PPM binary is then expecting a\n  different R location so it needs a binary rebuild. Added a 'force' flag, may need a list similar\n  to the blacklist to always compiled.\n\n- A small number of packages do not build for lack required components; examples are ROracle and\n  Rcplex.  They, and their reverse dependencies, are blacklisted and not built.\n\n- r2u is an `apt` repo, which via `bspm` becomes used \"automagically\" via standard R calls of\n  `install.packages()` and alike. That last part is important: package installations that do not use\n  `install.packages()` (such as `renv`, `rig`, ...) do not benefit from\n  `install.packages()` calling `apt` for you, and cannot take advantage of r2u via `bspm`.\n \n- `bspm` traces calls to `install.packages()` and maps them system-wide installation via `apt`.  By\n  choice, it does not map the `remove.packages()` for package removal, see [this\n  issue](https://github.com/Enchufa2/bspm/issues/43) for more discussion. Packages can be uninstalled\n  via the system package manager using, respectively, `apt`, `dpkg` or one of graphical frontends as\n  well as via the R function `bspm::remove_sys()`.\n\n### Author\n\nDirk Eddelbuettel\n\n### License\n\nThe repository-building code in this package is released under the GPL (\u003e= 2).\n\nAll CRAN and BioConductor packages are released under their respective licenses.\n\n### Acknowledgment\n\nThis was made possible by the generous support of endless coffee thanks to my\n[GitHub Sponsors](https://github.com/sponsors/eddelbuettel).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddelbuettel%2Fr2u","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddelbuettel%2Fr2u","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddelbuettel%2Fr2u/lists"}