-
Notifications
You must be signed in to change notification settings - Fork 62
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
support for installation from renv.lock lockfile? #343
Comments
pak has more information in its lockfile, so you cannot replace it with an renv lockfile. Nevertheless it is in the plans to install an renv lockfile. |
@kevinushey One issue with the renv lockfile is that AFAICT it does not contain the dependencies, so we don't know the right installation order. This means that to start the installation we would need to unpack all packages first, and then look up the dependencies. This would be much simpler if the lockfile also had the dependencies, just the package names, e.g. ...
"Package": "callr",
"Version": "3.7.0.9000",
"Source": "GitHub",
"RemoteType": "github",
"Dependencies": ["processx", "R6"],
... |
What values would be included in Resolving the installation order post-hoc doesn't seem that bad; if I understand correctly you'd have to do this anyway if someone provided (for example) a URL remote or another similar "exotic" remote. I'm not sure if supporting those is something |
Just those in the lockfile entries. renv does not add URLs for CRAN-like packages, so you'd need LinkingTo as well, in case a source package is installed. pak lockfiles have the dependencies for all packages, including exotic ones, for example pak::lockfile_create("url::https://cran.rstudio.com/src/contrib/cli_3.1.0.tar.gz") will create ...
{
"ref": "url::https://cran.rstudio.com/src/contrib/cli_3.1.0.tar.gz",
"package": "cli",
"version": "3.1.0",
"type": "url",
"direct": true,
"binary": false,
"dependencies": ["glue"],
"vignettes": false,
"needscompilation": true,
"metadata": {
"RemotePkgRef": "url::https://cran.rstudio.com/src/contrib/cli_3.1.0.tar.gz",
"RemoteType": "url",
"RemoteEtag": "\"75b0e-5cf56b5f6c91b\"",
"RemotePackaged": "TRUE"
},
"sources": ["https://cran.rstudio.com/src/contrib/cli_3.1.0.tar.gz"],
...
},
{
"ref": "glue",
"package": "glue",
"version": "1.5.1",
"type": "standard",
"direct": false,
"binary": true,
"dependencies": [],
"vignettes": false,
"needscompilation": false,
"metadata": {
"RemoteType": "standard",
"RemotePkgRef": "glue",
"RemoteRef": "glue",
"RemoteRepos": "https://cloud.r-project.org",
"RemotePkgPlatform": "aarch64-apple-darwin20",
"RemoteSha": "1.5.1"
},
"sources": ["https://cloud.r-project.org/bin/macosx/big-sur-arm64/contrib/4.1/glue_1.5.1.tgz", "https://mac.r-project.org/bin/macosx/big-sur-arm64/contrib/4.1/glue_1.5.1.tgz"],
... No dependency resolution is performed here at all, when installing this. We can start downloading packages right away, we don't even need the CRAN metadata. Then we can start installing them right away, using as many subprocesses as possible. FWIW other software does the same, e.g. a |
Would this be sufficient?
Note that 'Requirements' field which just provides the name of other packages in the lockfile this package depends on. |
Yes, that is exactly what we need, like in #343 (comment). |
@kevinushey So, if you add the dependencies to the lockfile, then I can implement this pretty quickly. |
This has been implemented now; the Requirements entry for each package record will be a JS array of package names (which are all of Depends / Imports / LinkingTo). You should see that if you test with the development version of |
@gaborcsardi @kevinushey Just passing by and querying for the current status as it has been quite here for some time. Using {pak} as a backend for {renv} package installs would really be great to have! 👀 |
I''ve just tried this with After installing
|
Is there any progress on this @gaborcsardi? I'd be happy to try to put together a PR if you can give some direction on how to go from the |
@kevinushey So if pak were to install packages from an renv lockfile, where would those packages go, and how would this work together with renv's libraries? Would the renv project need to be activated first? Would pak need to be a dependency in the renv project? If the renv project does not need to be active, then pak would install the packages into a regular (non-renv) library? That does not seem ideal. I don't really see how this would work. |
@ccasar where could we find the renv.lock that you have used? |
They would get installed into
Yes, to ensure the library paths are set appropriately.
It shouldn't; at least from the Just to re-iterate, right now,
That is, it transforms the lockfile record entries into short-form remotes (including their versions) that can be processed by |
OK, but that means that there is no pak function to add, and pak does not actually need to read the renv lockfile, and there is nothing to do here, essentially? |
I was able to reduce our GitHub Actions build times from ~4.5 hrs to ~1hr in this repo. I couldn't get I was able to cobble together a solution that uses
|
@alexvpickering One hour still seems pretty long, have you tried to use binary Linux packages from https://packagemanager.posit.co? Re Matrix.utils, that's not in the lockfile at https://github.com/hms-dbmi-cellenics/pipeline/blob/master/pipeline-runner/renv.lock, am I looking at the wrong file? Btw. the Bioconductor packages are supposed to install from their git repository? That seems a bit weird, and it is probably slower than installing them from their CRAN-like repository. |
@kevinushey Do you have a list of possible values for the |
Yeah, at least from Given this, there's probably not an explicit need for tl;dr: unless you plan to further extend pak here, I think we can close this? |
The main things you'll see there are "Repository", "Bioconductor", other values already encoded in "RemoteType", "unknown", and "Cellar" (for packages that were found in the |
Sorry, what I meant is, what values can be in the
but there are probably others? |
If the package was installed with It's probably easier to just look at the implementation here: https://github.com/rstudio/renv/blob/main/R/snapshot.R#L712-L760 |
Not tried yet. Locally the restore takes ~30 mins (more cores than GA) for ~250 packages. Time is fine for our purposes now as we also employ caching of images so 1hr is worst case scenario and much better than 4.5 hours. Timing would be improved decently if the
Yes sorry my bad, Matrix.utils was a problem case for a related repo. For the above repo, an example is spatstat.core.
Not sure I understand. All packages were just installed and snapshots taken as normal as far as I remember. |
Matrix.utils seems like a bug in pak/pkgdepends. In any case, if pkgdepends cannot install a package that it should be able to install, please open an issue! Thanks!
No worries, it was more of a question for Kevin, but I think I understand the reason now. |
It looks like
pak
has its own machinery for creating and installing from lockfiles, e.g.Is there a straightforward mechanism whereby lockfiles created by
renv.lock
could work here as well?The main barrier I see is that one cannot yet create lockfiles from versioned R packages; e.g.
If we had that, I think it would be straightforward for
renv
to create a list of versioned remotes that could be passed intopak
.The text was updated successfully, but these errors were encountered: