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

renv::restore() using pak as backend? #907

Closed
rpodcast opened this issue Jan 6, 2022 · 9 comments
Closed

renv::restore() using pak as backend? #907

rpodcast opened this issue Jan 6, 2022 · 9 comments

Comments

@rpodcast
Copy link

rpodcast commented Jan 6, 2022

I'm so excited to see the initial support for pak to install packages with renv! I have everything working for installing packages, but I am testing out the experience of cloning a project and restoring the packages, and running restore() still installs the packages one-by-one even with RENV_CONFIG_PAK_ENABLED = TRUE declared in the project's .Renviron file. Is there another way to trick restore() to leverage pak?

@kevinushey
Copy link
Collaborator

Not yet -- that work is being tracked on the pak side here. r-lib/pak#343

@yonicd
Copy link

yonicd commented Jun 21, 2022

I saw that renv::install() can be ported to pak (NEWS 0.15.0) via an ENV var. is there any way to run the renv::restore() via pak?

renv gains experimental support for the pak package. Set RENV_CONFIG_PAK_ENABLED = TRUE in an appropriate .Renviron file to enable pak integration. When enabled, calls to renv::install() will use pak to download and install packages.

@kevinushey
Copy link
Collaborator

I don't think the required infrastructure is available yet on the pak side.

@yonicd
Copy link

yonicd commented Jun 22, 2022

Sorry I didn’t explain correctly my question. If i set the env var to true and run renv::restore, should renv use pak to install the deps? Or is it not running renv::install (in a vectorized map) under the hood when it restores?

@yonicd
Copy link

yonicd commented Jun 22, 2022

Found it

restore runs directly *_impl which is too downstream in the direct install() sequence and the pak check clause is done higher up. It should be possible to let pak drive restore too

@kevinushey
Copy link
Collaborator

It should be possible to let pak drive restore too

But AFAIK pak doesn't support installation of packages from older versions, e.g.

> pak::pkg_install("renv@0.15.3")
Error: Cannot install packages:
* renv@0.15.3: Versioned CRAN packages are not implemented yet
Type .Last.error.trace to see where the error occurred

So until that's been implemented (or some other similar supporting infrastructure) we can't use pak for restore.

@yonicd
Copy link

yonicd commented Jun 22, 2022

ah. ok. thanks for the clarification

@yonicd
Copy link

yonicd commented Jun 22, 2022

I think this would work, since it uses cran github repo meta information, which is one way to do it.

> pak::pkg_install('cran/DiagrammeR@1.0.6.1')
v Updated metadata database: 4.26 MB in 4 files.                           
v Updating metadata database                                               
                                                                            
> Will install 3 packages.
> Will download 2 CRAN packages (88.30 kB).
> Will download 1 package with unknown size.
+ DiagrammeR   1.0.6.1 [bld][cmp][dl] (GitHub: e924ddd)
+ downloader   0.4     [dl] (24.96 kB)
+ influenceR   0.1.0.1 [dl] (63.33 kB)
i Getting 2 pkgs (88.30 kB) and 1 pkg with unknown size
v Got downloader 0.4 (windows) (24.96 kB)                                       
v Got influenceR 0.1.0.1 (windows) (63.33 kB)                                   
v Got DiagrammeR 1.0.6.1 (source) (4.88 MB)                  
v Downloaded 3 packages (4.97 MB)in 8s                       
v Installed downloader 0.4  (203ms)                                          
v Installed influenceR 0.1.0.1  (159ms)                                      
i Packaging DiagrammeR 1.0.6.1                                               
v Packaged DiagrammeR 1.0.6.1 (16.7s)                                        
i Building DiagrammeR 1.0.6.1                                              
v Built DiagrammeR 1.0.6.1 (28.6s)                                         
v Installed DiagrammeR 1.0.6.1 (github::cran/DiagrammeR@e924ddd) (1.5s)      
v 1 + 53 pkgs | kept 12, updated 0, new 3 | downloaded 3 (NA B) 1m 16s

@hadley
Copy link
Member

hadley commented Apr 26, 2023

Closing in favour of #1210

@hadley hadley closed this as completed Apr 26, 2023
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

4 participants