-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing binaries when collaborating across multiple operating systems #1052
Comments
Thanks for the bug report! In the interim, a workaround would be something like:
In other words, you could use the repos override option to change the repositories used during restore / install by |
The hash is the real blocker here I believe. pipfile.lock and the terraform lock file both allow for multiple hashes for a single package version so you can have all the OS hashes listed there and available to be restored. The renv equivalent hash property doesn't appear to be an array and is just a single hash value. Or does it support being an array under the covers? |
renv computes the hash based on (a mildly transformed version of) the package's DESCRIPTION file, and so the hash should be the same across platforms. |
Ok that's good news for us now. That doesn't offer any security against an altered package unless the attacker has also altered the DESCRIPTION file, right? Sorry, off topic. Back on topic, we're currently struggling to get the workaround to work and still receiving source packages on Ubuntu. I'll get my colleague to share details later |
Putting this in the shared project options(
repos = c(RSPM = "https://packagemanager.rstudio.com/all/latest",
CRAN = "https://cran.rstudio.com/"),
renv.config.auto.snapshot = TRUE
)
# Since RSPM does not provide Mac binaries, always install packages from CRAN
# on mac or windows, even if renv.lock specifies they came from RSPM
if (Sys.info()[["sysname"]] %in% c("Darwin", "Windows")) {
options(renv.config.repos.override = c(
CRAN = "https://cran.rstudio.com/",
INLA = "https://inla.r-inla-download.org/R/testing"))
} else if (Sys.info()[["sysname"]] == "Linux") {
options(renv.config.repos.override = c(
RSPM = "https://packagemanager.rstudio.com/all/latest",
INLA = "https://inla.r-inla-download.org/R/testing"))
} |
Thanks for sharing @noamross. However implementing the above still results in receiving packages from source for Linux. Were you able to get installs from binaries on linux? |
That's right. In general,
What version of Lines 17 to 21 in 66f339c
If you're still having trouble, then a similar solution explicitly checking the operating system and setting the binary repository explicitly should suffice, based on the contents of the |
@kevinushey just FYI @mungojam and I are colleagues. To answer you questions:
This is my .Rprofile wondering if im missing something:
Version of R = 4.1.2 (cannot use a more recent version due to project requirements) Important to note I am only installing standard packages e.g: dplyr, readr, data.table, dependencies for R notebooks etc. |
That looks correct to me, assuming all Linux machines are running Ubuntu Bionic. Are you still seeing issues even with this set? If not, can you clarify what you're seeing when you run |
Hi @kevinushey For reference here is a simple repo I have created for this example only utilising the dplyr and readr packages and the associated NB packages When pulling the repo and opening the project from a fresh Linux (Ubuntu 18.04 (Bionic)) instance and running It is downloading the source files no? Is it building the binaries and caching them? Note: I have created the RSPM repo URL from: Posit Package Manager |
On Linux, RSPM serves binary packages "disguised" as source packages (when using a binary repository URL; e.g. one that includes |
Okay thanks for clearing that up! |
Could anyone post an example for what to put into |
I think since Posit package manager now serves binaries for all three major platforms, the problem is almost irrelevant for most people. At least for my use case (package {precommit}), binary installs works on all platforms out of the box when I specify PPM as my first CRAN repo. |
If you're using
The big missing piece is macOS binaries on arm64; once those are ready we can confidently use PPM by default in all cases. |
We are adding Posit Package Manager to our stack. What is your recommendation for when the
Thanks. |
If you need to only update the repositories used in the lockfile, you can use:
(or, alternatively, edit the lockfile by hand to update the repository URLs) Note also that |
Fabulous. I hadn't seen that function released. I think this is what I'll have users run.
|
When on an
renv
enabled project where collaborators or machines may be Linux or macOS, one can generally get binaries to install on Linux or macOS machines, but not both. This is because CRAN hosts macOS binaries, and RSPM hosts Linux binaries, but inrenv.lock
individual packages are designated by a single repository, even if the package source hash would be identical across repositories. I assume similar issues arise with Windows. I would like there to be a configuration in which the binary version of a package, hosted from either repository, can be preferred for installation on any OS.In my setup, collaborators may be on Linux or macOS machines, and we use/commit project-level
.Rprofile
files as well asrenv.lock
files to keep our environments in sync. Therenv
-relevant part of the.Rprofile
is this:And so we have
renv.lock
files that look like this, but the repository source of a package (CRAN/RSPM) generally depends on whether the user who committed the change is on Linux or macOS:I note I would expect
renv.lock
to override repository preferences in.Rprofile
when runningrenv::restore()
, and the repositories set in.Rprofile()
to determine the source of new packages installed into the library. Perhaps packages inrenv.lock
can have multipleRepository
values and there can be anrenv.prefer.binary.repository = TRUE
option.(Migrating from this post on the RStudio forum: https://community.rstudio.com/t/renv-and-rspm-for-binary-installs-on-shared-linux-mac-project/143054/2 by request of @kevinushey)
The text was updated successfully, but these errors were encountered: