Skip to content
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 packages in parallel with restore() #459

Closed
KasperSkytte opened this issue Jun 22, 2020 · 8 comments
Closed

Installing packages in parallel with restore() #459

KasperSkytte opened this issue Jun 22, 2020 · 8 comments

Comments

@KasperSkytte
Copy link

Hi!

I'm using renv a heck of a lot across different computers and projects, great package. But this also means running renv::restore() several times a day, and it usually takes half an hour or more to install all the packages from scratch. I am hoping to speed this up as much as possible. Would it be possible to implement a sort of parallel installation of packages similar to fx install.packages(..., Ncpus = 8) when using renv::restore()? Or perhaps to pass arguments on to install.packages(...) through renv::restore(...), in particular the Ncpus argument? But I'm unsure if this would work with the (very nice!) caching of packages with renv, I'll leave that to you.

Regards
Kasper

@kevinushey
Copy link
Collaborator

Thanks for the feature request! This is definitely something I want to implement in the future; just haven't been able to carve out time for this yet.

@jucor
Copy link

jucor commented Jul 17, 2020

This would be a fantastic addition :) Thanks for considering it! How can we help?

@KasperSkytte
Copy link
Author

This is still highly relevant to me. How much work do you think it would take? I'll gladly contribute if it's not too complicated.

@yrro
Copy link

yrro commented Sep 24, 2021

Try this workaround in your .Rprofile:

Sys.setenv(MAKEFLAGS = sprintf("-j%d", parallel::detectCores()))

@KasperSkytte
Copy link
Author

@yrro That would only be for anything involving make, usually compiled code, and not actually installing multiple packages in parallel, independently. It does speed things up a bit, but most other steps are still taking long

@alonme
Copy link

alonme commented Dec 2, 2021

@kevinushey - Any news? Any way we can help?

@kevinushey
Copy link
Collaborator

The development version of renv now has experimental support for pak, which can be used to install packages in parallel. For example:

options(renv.config.pak.enabled = TRUE)
.libPaths(tempdir())
renv::install("tidyverse")

pak will take care of downloading + installing all the required packages in parallel. On my M1 macOS machine, this completes pretty quickly:

✓ 1 pkg + 98 deps: kept 5, added 94, dld 94 (55.90 MB) [1m 30.5s]      

Note that pak does not yet support installation of packages from the CRAN archives, which we need for restore -- hopefully that will come in a future release. Once we're more certain the integration is solid we'll consider turning this on by default.

@alonme
Copy link

alonme commented Dec 9, 2021

Thanks @kevinushey ,

Linking the relevant issue in pak r-lib/pak#343

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants