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

ppm.enabled in settings vs. config #1901

Open
bzkrouse opened this issue May 13, 2024 · 3 comments
Open

ppm.enabled in settings vs. config #1901

bzkrouse opened this issue May 13, 2024 · 3 comments
Labels
bug an unexpected problem or unintended behavior install 🧺
Milestone

Comments

@bzkrouse
Copy link

The documentation implies that the config and settings ppm.enabled options operate similarly. However a recent use case brought up some questions about the difference between these two options. Here is the scenario:

  • Repo is set to a specific, older CRAN snapshot
  • Package version from the specified CRAN snapshot is earlier than the default package version from P3M (according to the version of R being used in the session)
  • Windows OS

For example, from R 4.3.2, the following code:

renv::install("dplyr", repos = "https://packagemanager.posit.co/cran/2023-03-01")

Results in

# Downloading packages -------------------------------------------------------
- Downloading dplyr from P3M ...                OK [1.5 Mb in 2.1s]
Successfully downloaded 1 package in 2.3 seconds.
The following package(s) will be installed:
- dplyr [1.1.4]

As opposed to downloading dplyr 1.1.0 from the 2023-03-01 snapshot.
I have found that if I set config ppm.enabled = FALSE and settings ppm.enabled = TRUE, I think I am able to avoid {renv} from reaching out to P3M, while keeping other benefits of PPM being enabled.

Is this the expected behavior/the recommended configuration for sticking to just the specified repos? If so, is there a way to update the documentation so these 2 options can be more easily distinguished?

Thanks very much in advance for your help!

@kevinushey
Copy link
Collaborator

Thanks! This seems unexpected to me; I'll need to investigate further.

At least locally, I see:

> renv::install("dplyr", repos = "https://packagemanager.posit.co/cran/2023-03-01")
The following package(s) will be installed:
- dplyr [1.1.0]
These packages will be installed into "~/Library/R/arm64/4.4/library".

Can you share the output of renv::diagnostics(), just in case anything useful is provided therein?

@bzkrouse
Copy link
Author

@kevinushey thanks for your reply. I should mention I only have this issue on Windows. Here are some diagnostics:

 Diagnostics Report [renv 1.0.7]
===============================

# Session Info ---------------------------------------------------------------
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
loaded via a namespace (and not attached):
[1] compiler_4.3.2 tools_4.3.2    renv_1.0.7    
# Project --------------------------------------------------------------------
Project path: "~/renv_ppm"

# Status ---------------------------------------------------------------------
This project does not contain a lockfile.
Use `renv::snapshot()` to create a lockfile.
# Packages -------------------------------------------------------------------
This project has not yet been snapshotted: 'renv.lock' does not exist.
            Library Source Lockfile Source Path Dependency
KernSmooth  2.23-22   CRAN     <NA>   <NA>  [2]       <NA>
MASS         7.3-60   CRAN     <NA>   <NA>  [2]       <NA>
Matrix      1.6-1.1   CRAN     <NA>   <NA>  [2]       <NA>
boot       1.3-28.1   CRAN     <NA>   <NA>  [2]       <NA>
class        7.3-22   CRAN     <NA>   <NA>  [2]       <NA>
cluster       2.1.4   CRAN     <NA>   <NA>  [2]       <NA>
codetools    0.2-19   CRAN     <NA>   <NA>  [2]       <NA>
foreign      0.8-85   CRAN     <NA>   <NA>  [2]       <NA>
lattice      0.21-9   CRAN     <NA>   <NA>  [2]       <NA>
mgcv          1.9-0   CRAN     <NA>   <NA>  [2]       <NA>
nlme        3.1-163   CRAN     <NA>   <NA>  [2]       <NA>
nnet         7.3-19   CRAN     <NA>   <NA>  [2]       <NA>
renv          1.0.7   CRAN     <NA>   <NA>  [1]     direct
rpart        4.1.21   CRAN     <NA>   <NA>  [2]       <NA>
spatial      7.3-17   CRAN     <NA>   <NA>  [2]       <NA>
utils          <NA>   <NA>     <NA>   <NA>  [2]   indirect
        
# ABI ------------------------------------------------------------------------
- ABI conflict checks are not available on Windows.
# User Profile ---------------------------------------------------------------
[no user profile detected]
# Settings -------------------------------------------------------------------
List of 13
 $ bioconductor.version     : NULL
 $ external.libraries       : chr(0) 
 $ ignored.packages         : chr(0) 
 $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo"
 $ ppm.enabled              : NULL
 $ ppm.ignored.urls         : chr(0) 
 $ r.version                : NULL
 $ snapshot.type            : chr "implicit"
 $ use.cache                : logi TRUE
 $ vcs.ignore.cellar        : logi TRUE
 $ vcs.ignore.library       : logi TRUE
 $ vcs.ignore.local         : logi TRUE
 $ vcs.manage.ignores       : logi TRUE
# Options --------------------------------------------------------------------
List of 7
 $ defaultPackages                     : chr [1:6] "datasets" "utils" "grDevices" "graphics" ...
 $ download.file.method                : chr "libcurl"
 $ download.file.extra                 : NULL
 $ install.packages.compile.from.source: chr "interactive"
 $ pkgType                             : chr "both"
 $ repos                               : Named chr "https://packagemanager.posit.co/cran/2023-03-01"
  ..- attr(*, "names")= chr "CRAN"
 $ renv.verbose                        : logi TRUE

@kevinushey
Copy link
Collaborator

Thanks! I can confirm the issue now. The issue is alleviated if you set:

options(renv.config.ppm.enabled = FALSE)

before installation.

The problem occurs because renv looks for the latest-available package either from the current snapshot, or from any other available PPM snapshot, as in here:

renv/R/available-packages.R

Lines 390 to 394 in 5d0d52c

methods <- list(
renv_available_packages_latest_repos,
if (renv_p3m_enabled())
renv_available_packages_latest_p3m
)

I think if we're already installing from, or using, a specific PPM snapshot, then we'd want to avoid using other PPM snapshots.

@kevinushey kevinushey added this to the 1.1.0 milestone May 17, 2024
@kevinushey kevinushey added bug an unexpected problem or unintended behavior install 🧺 labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior install 🧺
Projects
None yet
Development

No branches or pull requests

2 participants