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} 0.17.0 cannot find rmarkdown on hydrate with bare project on CI #1161

Closed
zkamvar opened this issue Mar 8, 2023 · 11 comments
Closed

Comments

@zkamvar
Copy link
Contributor

zkamvar commented Mar 8, 2023

I'm having a problem with {sandpaper}, which uses {renv} to provision a non-invasive dependencies for lessons.

I'm finding an odd situation: on Continuous integration, and ONLY on R > 4.2 and < 4.0, {renv} can not detect {rmarkdown} during bootstrap.

During bootstrap, I do the following steps:

  1. initialise the project containing R Markdown files with a bare renv with a named profile
  2. run hydrate to capture all packages in the project
  3. snapshot

However, with the latest version of {renv}, I've noticed problems with the bootstrap hydration phase:

  * Discovering package dependencies ... Done!
  The following packages are used in this project, but not available locally:
  
  	rmarkdown
  
  renv will attempt to download and install these packages.
  
  * Hydrated 0 packages in 0.005 milliseconds.

But when I run renv::diagnostics(), {rmarkdown} is available locally:

diagnostics report
Diagnostics Report [renv 0.17.0-27]
  ===================================
  
  # Session Info =======================
  R version 4.2.2 (2022-10-31)
  Platform: x86_64-pc-linux-gnu (64-bit)
  Running under: Ubuntu 22.04.2 LTS
  
  Matrix products: default
  BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
  LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so
  
  locale:
   [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
   [4] LC_COLLATE=C           LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
   [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
  [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  loaded via a namespace (and not attached):
  [1] compiler_4.2.2 cli_3.6.0      tools_4.2.2    yaml_2.3.7     renv_0.17.0-27
  
  # Project ============================
  Project path: "/tmp/RtmpzoFKmi/working_dir/RtmpaXzVNh/file33036bcd010a/lesson-example"
  
  # Status =============================
  * This project has not yet been snapshotted -- 'renv.lock' does not exist.
  The following package(s) are installed, but not recorded in the lockfile:
              _
    knitr       [1.42]
    magrittr    [2.0.3]
    rappdirs    [0.3.3]
    R6          [2.5.1]
    rlang       [1.0.6]
    fastmap     [1.1.1]
    stringr     [1.5.0]
    highr       [0.10]
    xfun        [0.37]
    tinytex     [0.44]
    cli         [3.6.0]
    jquerylib   [0.1.4]
    htmltools   [0.5.4]
    ellipsis    [0.3.2]
    yaml        [2.3.7]
    digest      [0.6.31]
    lifecycle   [1.0.3]
    sass        [0.4.5]
    base64enc   [0.1-3]
    vctrs       [0.5.2]
    fs          [1.6.1]
    memoise     [2.0.1]
    glue        [1.6.2]
    cachem      [1.0.7]
    evaluate    [0.20]
    mime        [0.12]
    rmarkdown   [2.20]
    stringi     [1.7.12]
    bslib       [0.4.2]
    jsonlite    [1.8.4]
    renv        [rstudio/renv@HEAD]
  
  Use `renv::snapshot()` to add these packages to the lockfile.
  
  
  # Packages ===========================
  This project has not yet been snapshotted: 'renv.lock' does not exist.
                 Library      Source Lockfile Source Path Dependency
  KernSmooth     2.23-20        CRAN     <NA>   <NA>  [1]       <NA>
  MASS          7.3-58.1        CRAN     <NA>   <NA>  [1]       <NA>
  Matrix           1.5-1        CRAN     <NA>   <NA>  [1]       <NA>
  R6               2.5.1        RSPM     <NA>   <NA>  [1]   indirect
  Rcpp            1.0.10        RSPM     <NA>   <NA>  [1]       <NA>
  askpass            1.1        RSPM     <NA>   <NA>  [1]       <NA>
  assertthat       0.2.1        RSPM     <NA>   <NA>  [1]       <NA>
  base64enc        0.1-3        RSPM     <NA>   <NA>  [1]   indirect
  boot            1.3-28        CRAN     <NA>   <NA>  [1]       <NA>
  brio             1.1.3        RSPM     <NA>   <NA>  [1]       <NA>
  bslib            0.4.2        RSPM     <NA>   <NA>  [1]   indirect
  cachem           1.0.7        RSPM     <NA>   <NA>  [1]   indirect
  callr            3.7.3        RSPM     <NA>   <NA>  [1]       <NA>
  class           7.3-20        CRAN     <NA>   <NA>  [1]       <NA>
  cli              3.6.0        RSPM     <NA>   <NA>  [1]   indirect
  clipr            0.8.0        RSPM     <NA>   <NA>  [1]       <NA>
  cluster          2.1.4        CRAN     <NA>   <NA>  [1]       <NA>
  codetools       0.2-18        CRAN     <NA>   <NA>  [2]       <NA>
  commonmark       1.8.1        RSPM     <NA>   <NA>  [1]       <NA>
  covr             3.6.1        RSPM     <NA>   <NA>  [1]       <NA>
  cpp11            0.4.3        RSPM     <NA>   <NA>  [1]       <NA>
  crayon           1.5.2        RSPM     <NA>   <NA>  [1]       <NA>
  credentials      1.3.2        RSPM     <NA>   <NA>  [1]       <NA>
  curl             5.0.0        RSPM     <NA>   <NA>  [1]       <NA>
  desc             1.4.2        RSPM     <NA>   <NA>  [1]       <NA>
  diffobj          0.3.5        RSPM     <NA>   <NA>  [1]       <NA>
  digest          0.6.31        RSPM     <NA>   <NA>  [1]   indirect
  downlit          0.4.2        RSPM     <NA>   <NA>  [1]       <NA>
  ellipsis         0.3.2        RSPM     <NA>   <NA>  [1]   indirect
  evaluate          0.20        RSPM     <NA>   <NA>  [1]   indirect
  fansi            1.0.4        RSPM     <NA>   <NA>  [1]       <NA>
  fastmap          1.1.1        RSPM     <NA>   <NA>  [1]   indirect
  foreign         0.8-83        CRAN     <NA>   <NA>  [1]       <NA>
  fs               1.6.1        RSPM     <NA>   <NA>  [1]   indirect
  gert             1.9.2        RSPM     <NA>   <NA>  [1]       <NA>
  gh               1.4.0        RSPM     <NA>   <NA>  [1]       <NA>
  gitcreds         0.1.2        RSPM     <NA>   <NA>  [1]       <NA>
  glue             1.6.2        RSPM     <NA>   <NA>  [1]   indirect
  grDevices         <NA>        <NA>     <NA>   <NA>  [2]   indirect
  graphics          <NA>        <NA>     <NA>   <NA>  [2]   indirect
  highr             0.10        RSPM     <NA>   <NA>  [1]   indirect
  htmltools        0.5.4        RSPM     <NA>   <NA>  [1]   indirect
  httpuv           1.6.9        RSPM     <NA>   <NA>  [1]       <NA>
  httr             1.4.5        RSPM     <NA>   <NA>  [1]       <NA>
  httr2            0.2.2        RSPM     <NA>   <NA>  [1]       <NA>
  ini              0.3.1        RSPM     <NA>   <NA>  [1]       <NA>
  jquerylib        0.1.4        RSPM     <NA>   <NA>  [1]   indirect
  jsonlite         1.8.4        RSPM     <NA>   <NA>  [1]   indirect
  knitr             1.42        RSPM     <NA>   <NA>  [1]   indirect
  later            1.3.0        RSPM     <NA>   <NA>  [1]       <NA>
  lattice        0.20-45        CRAN     <NA>   <NA>  [1]       <NA>
  lazyeval         0.2.2        RSPM     <NA>   <NA>  [1]       <NA>
  lifecycle        1.0.3        RSPM     <NA>   <NA>  [1]   indirect
  magrittr         2.0.3        RSPM     <NA>   <NA>  [1]   indirect
  markdown           1.5        RSPM     <NA>   <NA>  [1]       <NA>
  memoise          2.0.1        RSPM     <NA>   <NA>  [1]   indirect
  methods           <NA>        <NA>     <NA>   <NA>  [2]   indirect
  mgcv            1.8-41        CRAN     <NA>   <NA>  [1]       <NA>
  mime              0.12        RSPM     <NA>   <NA>  [1]   indirect
  mockr            0.2.1        RSPM     <NA>   <NA>  [1]       <NA>
  nlme           3.1-160        CRAN     <NA>   <NA>  [1]       <NA>
  nnet            7.3-18        CRAN     <NA>   <NA>  [1]       <NA>
  openssl          2.0.5        RSPM     <NA>   <NA>  [1]       <NA>
  pegboard         0.4.3      GitHub     <NA>   <NA>  [1]       <NA>
  pillar           1.8.1        RSPM     <NA>   <NA>  [1]       <NA>
  pkgconfig        2.0.3        RSPM     <NA>   <NA>  [1]       <NA>
  pkgdown          2.0.7        RSPM     <NA>   <NA>  [1]       <NA>
  pkgload          1.3.2        RSPM     <NA>   <NA>  [1]       <NA>
  praise           1.0.0        RSPM     <NA>   <NA>  [1]       <NA>
  processx         3.8.0        RSPM     <NA>   <NA>  [1]       <NA>
  promises       1.2.0.1        RSPM     <NA>   <NA>  [1]       <NA>
  ps               1.7.2        RSPM     <NA>   <NA>  [1]       <NA>
  purrr            1.0.1        RSPM     <NA>   <NA>  [1]       <NA>
  ragg             1.2.5        RSPM     <NA>   <NA>  [1]       <NA>
  rappdirs         0.3.3        RSPM     <NA>   <NA>  [1]   indirect
  rematch2         2.1.2        RSPM     <NA>   <NA>  [1]       <NA>
  renv         0.17.0-27      GitHub     <NA>   <NA>  [1]       <NA>
  rex              1.2.1        RSPM     <NA>   <NA>  [1]       <NA>
  rlang            1.0.6        RSPM     <NA>   <NA>  [1]   indirect
  rmarkdown         2.20        RSPM     <NA>   <NA>  [1]     direct
  rpart           4.1.19        CRAN     <NA>   <NA>  [1]       <NA>
  rprojroot        2.0.3        RSPM     <NA>   <NA>  [1]       <NA>
  rstudioapi        0.14        RSPM     <NA>   <NA>  [1]       <NA>
  sandpaper       0.11.7 carpentries     <NA>   <NA>  [1]       <NA>
  sass             0.4.5        RSPM     <NA>   <NA>  [1]   indirect
  servr             0.25        RSPM     <NA>   <NA>  [1]       <NA>
  sessioninfo      1.2.2        RSPM     <NA>   <NA>  [1]       <NA>
  spatial         7.3-15        CRAN     <NA>   <NA>  [1]       <NA>
  stats             <NA>        <NA>     <NA>   <NA>  [2]   indirect
  stringi         1.7.12        RSPM     <NA>   <NA>  [1]   indirect
  stringr          1.5.0        RSPM     <NA>   <NA>  [1]   indirect
  survival         3.4-0        CRAN     <NA>   <NA>  [1]       <NA>
  sys              3.4.1        RSPM     <NA>   <NA>  [1]       <NA>
  systemfonts      1.0.4        RSPM     <NA>   <NA>  [1]       <NA>
  testthat         3.1.6        RSPM     <NA>   <NA>  [1]       <NA>
  textshaping      0.3.6        RSPM     <NA>   <NA>  [1]       <NA>
  tibble           3.2.0        CRAN     <NA>   <NA>  [1]       <NA>
  tinkr       0.1.0.9000      GitHub     <NA>   <NA>  [1]       <NA>
  tinytex           0.44        RSPM     <NA>   <NA>  [1]   indirect
  tools             <NA>        <NA>     <NA>   <NA>  [2]   indirect
  usethis          2.1.6        RSPM     <NA>   <NA>  [1]       <NA>
  utf8             1.2.3        RSPM     <NA>   <NA>  [1]       <NA>
  utils             <NA>        <NA>     <NA>   <NA>  [2]   indirect
  varnish         0.2.14      GitHub     <NA>   <NA>  [1]       <NA>
  vctrs            0.5.2        RSPM     <NA>   <NA>  [1]   indirect
  waldo            0.4.0        RSPM     <NA>   <NA>  [1]       <NA>
  whisker          0.4.1        RSPM     <NA>   <NA>  [1]       <NA>
  withr            2.5.0        RSPM     <NA>   <NA>  [1]       <NA>
  xfun              0.37        RSPM     <NA>   <NA>  [1]   indirect
  xml2             1.3.3        RSPM     <NA>   <NA>  [1]       <NA>
  xslt             1.4.4        RSPM     <NA>   <NA>  [1]       <NA>
  yaml             2.3.7        RSPM     <NA>   <NA>  [1]   indirect
  zip              2.2.2        RSPM     <NA>   <NA>  [1]       <NA>
  
  [1]: /tmp/RtmpzoFKmi/RLIBS_1931164ef33f
  [2]: /opt/R/4.2.2/lib/R/library        
  
  # ABI ================================
  * No ABI conflicts were detected in the set of installed packages.
  
  # User Profile =======================
  [1] Source  Package Require Version Dev    
  <0 rows> (or 0-length row.names)
  
  # Settings ===========================
  List of 10
   $ bioconductor.version     : chr(0) 
   $ external.libraries       : chr(0) 
   $ ignored.packages         : chr(0) 
   $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo"
   $ r.version                : chr(0) 
   $ snapshot.type            : chr "implicit"
   $ use.cache                : logi TRUE
   $ vcs.ignore.cellar        : logi TRUE
   $ vcs.ignore.library       : logi TRUE
   $ vcs.ignore.local         : logi TRUE
  
  # Options ============================
  List of 8
   $ defaultPackages                     : chr [1:6] "datasets" "utils" "grDevices" "graphics" ...
   $ download.file.method                : NULL
   $ download.file.extra                 : NULL
   $ install.packages.compile.from.source: NULL
   $ pkgType                             : chr "source"
   $ repos                               : Named chr [1:3] "https://carpentries.r-universe.dev/" "https://carpentries.github.io/drat" "https://cran.rstudio.com"
    ..- attr(*, "names")= chr [1:3] "carpentries" "carpentries_archive" "CRAN"
   $ renv.config.user.profile            : logi FALSE
   $ renv.verbose                        : logi TRUE
  
  # Environment Variables ==============
  HOME                       = /home/runner
  LANG                       = C.UTF-8
  MAKE                       = make
  RENV_CONFIG_CACHE_SYMLINKS = FALSE
  RENV_CONFIG_REPOS_OVERRIDE = https://packagemanager.posit.co/cran/__linux__/jammy/latest
  RENV_PATHS_ROOT            = /home/runner/.local/share/renv
  RENV_PATHS_SANDBOX         = /home/runner/work/_temp/sandbox/
  RENV_PROFILE               = lesson-requirements
  R_LIBS                     = /tmp/RtmpzoFKmi/RLIBS_[1931](https://github.com/carpentries/sandpaper/actions/runs/4367134933/jobs/7638060723#step:13:1934)164ef33f
  R_LIBS_SITE                = NULL
  R_LIBS_USER                = NULL
  
  # PATH ===============================
  - /home/runner/work/sandpaper/sandpaper/check/sandpaper.Rcheck/R_check_bin
  - /home/runner/.local/bin
  - /opt/pipx_bin
  - /home/runner/.cargo/bin
  - /home/runner/.config/composer/vendor/bin
  - /usr/local/.ghcup/bin
  - /home/runner/.dotnet/tools
  - /snap/bin
  - /usr/local/sbin
  - /usr/local/bin
  - /usr/sbin
  - /usr/bin
  - /sbin
  - /bin
  - /usr/games
  - /usr/local/games
  - /snap/bin
  
  # Cache ==============================
  There are a total of 114 package(s) installed in the renv cache.
  Cache path: "~/.local/share/renv/cache/v5/R-4.2/x86_64-pc-linux-gnu"
  
  → Recording changes in lockfile
  The following package(s) will be updated in the lockfile:
  
  # GitHub =============================
  - renv   [* -> rstudio/renv@HEAD]
  
  The version of R recorded in the lockfile will be updated:
  - R      [* -> 4.2.2]
  
  * Lockfile written to '/tmp/RtmpzoFKmi/working_dir/RtmpaXzVNh/file33036bcd010a/lesson-example/renv/profiles/lesson-requirements/renv.lock'.
  ℹ Current RENV_PATHS_ROOT /home/runner/.local/share/renv
  ℹ Current renv::paths$root() /home/runner/.local/share/renv
  ℹ ↓ Example lesson in '/tmp/RtmpzoFKmi/working_dir/RtmpaXzVNh/file33036bcd010a/lesson-example'
  ℹ ↑ Local remote in '/tmp/RtmpzoFKmi/working_dir/RtmpaXzVNh/REMOTE-330310e9e5a8'
  i Consent for package cache revoked. Use `use_package_cache()` to undo.
  → Searching for and installing available dependencies
  → Hydrating missing dependencies
  * Discovering package dependencies ... Done!
  The following packages are used in this project, but not available locally:
  
  	rmarkdown
  
  renv will attempt to download and install these packages.
  
  * Hydrated 0 packages in 0.0048 milliseconds.
  $packages
  named list()
  
  $missing
  NULL
  
  Diagnostics Report [renv 0.17.0-27]
  ===================================
  
  # Session Info =======================
  R version 4.2.2 (2022-10-31)
  Platform: x86_64-pc-linux-gnu (64-bit)
  Running under: Ubuntu 22.04.2 LTS
  
  Matrix products: default
  BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
  LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so
  
  locale:
   [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
   [4] LC_COLLATE=C           LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
   [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
  [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  loaded via a namespace (and not attached):
  [1] compiler_4.2.2 cli_3.6.0      tools_4.2.2    yaml_2.3.7     renv_0.17.0-27
  
  # Project ============================
  Project path: "/tmp/RtmpzoFKmi/working_dir/RtmpaXzVNh/file33031fa1cacd/lesson-init-example"
  
  # Status =============================
  * This project has not yet been snapshotted -- 'renv.lock' does not exist.
  The following package(s) are installed, but not recorded in the lockfile:
              _
    knitr       [1.42]
    magrittr    [2.0.3]
    rappdirs    [0.3.3]
    R6          [2.5.1]
    rlang       [1.0.6]
    fastmap     [1.1.1]
    stringr     [1.5.0]
    highr       [0.10]
    xfun        [0.37]
    tinytex     [0.44]
    cli         [3.6.0]
    jquerylib   [0.1.4]
    htmltools   [0.5.4]
    ellipsis    [0.3.2]
    yaml        [2.3.7]
    digest      [0.6.31]
    lifecycle   [1.0.3]
    sass        [0.4.5]
    base64enc   [0.1-3]
    vctrs       [0.5.2]
    fs          [1.6.1]
    memoise     [2.0.1]
    glue        [1.6.2]
    cachem      [1.0.7]
    evaluate    [0.20]
    mime        [0.12]
    rmarkdown   [2.20]
    stringi     [1.7.12]
    bslib       [0.4.2]
    jsonlite    [1.8.4]
    renv        [rstudio/renv@HEAD]
  
  Use `renv::snapshot()` to add these packages to the lockfile.
  
  
  # Packages ===========================
  This project has not yet been snapshotted: 'renv.lock' does not exist.
                 Library      Source Lockfile Source Path Dependency
  KernSmooth     2.23-20        CRAN     <NA>   <NA>  [1]       <NA>
  MASS          7.3-58.1        CRAN     <NA>   <NA>  [1]       <NA>
  Matrix           1.5-1        CRAN     <NA>   <NA>  [1]       <NA>
  R6               2.5.1        RSPM     <NA>   <NA>  [1]   indirect
  Rcpp            1.0.10        RSPM     <NA>   <NA>  [1]       <NA>
  askpass            1.1        RSPM     <NA>   <NA>  [1]       <NA>
  assertthat       0.2.1        RSPM     <NA>   <NA>  [1]       <NA>
  base64enc        0.1-3        RSPM     <NA>   <NA>  [1]   indirect
  boot            1.3-28        CRAN     <NA>   <NA>  [1]       <NA>
  brio             1.1.3        RSPM     <NA>   <NA>  [1]       <NA>
  bslib            0.4.2        RSPM     <NA>   <NA>  [1]   indirect
  cachem           1.0.7        RSPM     <NA>   <NA>  [1]   indirect
  callr            3.7.3        RSPM     <NA>   <NA>  [1]       <NA>
  class           7.3-20        CRAN     <NA>   <NA>  [1]       <NA>
  cli              3.6.0        RSPM     <NA>   <NA>  [1]   indirect
  clipr            0.8.0        RSPM     <NA>   <NA>  [1]       <NA>
  cluster          2.1.4        CRAN     <NA>   <NA>  [1]       <NA>
  codetools       0.2-18        CRAN     <NA>   <NA>  [2]       <NA>
  commonmark       1.8.1        RSPM     <NA>   <NA>  [1]       <NA>
  covr             3.6.1        RSPM     <NA>   <NA>  [1]       <NA>
  cpp11            0.4.3        RSPM     <NA>   <NA>  [1]       <NA>
  crayon           1.5.2        RSPM     <NA>   <NA>  [1]       <NA>
  credentials      1.3.2        RSPM     <NA>   <NA>  [1]       <NA>
  curl             5.0.0        RSPM     <NA>   <NA>  [1]       <NA>
  desc             1.4.2        RSPM     <NA>   <NA>  [1]       <NA>
  diffobj          0.3.5        RSPM     <NA>   <NA>  [1]       <NA>
  digest          0.6.31        RSPM     <NA>   <NA>  [1]   indirect
  downlit          0.4.2        RSPM     <NA>   <NA>  [1]       <NA>
  ellipsis         0.3.2        RSPM     <NA>   <NA>  [1]   indirect
  evaluate          0.20        RSPM     <NA>   <NA>  [1]   indirect
  fansi            1.0.4        RSPM     <NA>   <NA>  [1]       <NA>
  fastmap          1.1.1        RSPM     <NA>   <NA>  [1]   indirect
  foreign         0.8-83        CRAN     <NA>   <NA>  [1]       <NA>
  fs               1.6.1        RSPM     <NA>   <NA>  [1]   indirect
  gert             1.9.2        RSPM     <NA>   <NA>  [1]       <NA>
  gh               1.4.0        RSPM     <NA>   <NA>  [1]       <NA>
  gitcreds         0.1.2        RSPM     <NA>   <NA>  [1]       <NA>
  glue             1.6.2        RSPM     <NA>   <NA>  [1]   indirect
  grDevices         <NA>        <NA>     <NA>   <NA>  [2]   indirect
  graphics          <NA>        <NA>     <NA>   <NA>  [2]   indirect
  highr             0.10        RSPM     <NA>   <NA>  [1]   indirect
  htmltools        0.5.4        RSPM     <NA>   <NA>  [1]   indirect
  httpuv           1.6.9        RSPM     <NA>   <NA>  [1]       <NA>
  httr             1.4.5        RSPM     <NA>   <NA>  [1]       <NA>
  httr2            0.2.2        RSPM     <NA>   <NA>  [1]       <NA>
  ini              0.3.1        RSPM     <NA>   <NA>  [1]       <NA>
  jquerylib        0.1.4        RSPM     <NA>   <NA>  [1]   indirect
  jsonlite         1.8.4        RSPM     <NA>   <NA>  [1]   indirect
  knitr             1.42        RSPM     <NA>   <NA>  [1]   indirect
  later            1.3.0        RSPM     <NA>   <NA>  [1]       <NA>
  lattice        0.20-45        CRAN     <NA>   <NA>  [1]       <NA>
  lazyeval         0.2.2        RSPM     <NA>   <NA>  [1]       <NA>
  lifecycle        1.0.3        RSPM     <NA>   <NA>  [1]   indirect
  magrittr         2.0.3        RSPM     <NA>   <NA>  [1]   indirect
  markdown           1.5        RSPM     <NA>   <NA>  [1]       <NA>
  memoise          2.0.1        RSPM     <NA>   <NA>  [1]   indirect
  methods           <NA>        <NA>     <NA>   <NA>  [2]   indirect
  mgcv            1.8-41        CRAN     <NA>   <NA>  [1]       <NA>
  mime              0.12        RSPM     <NA>   <NA>  [1]   indirect
  mockr            0.2.1        RSPM     <NA>   <NA>  [1]       <NA>
  nlme           3.1-160        CRAN     <NA>   <NA>  [1]       <NA>
  nnet            7.3-18        CRAN     <NA>   <NA>  [1]       <NA>
  openssl          2.0.5        RSPM     <NA>   <NA>  [1]       <NA>
  pegboard         0.4.3      GitHub     <NA>   <NA>  [1]       <NA>
  pillar           1.8.1        RSPM     <NA>   <NA>  [1]       <NA>
  pkgconfig        2.0.3        RSPM     <NA>   <NA>  [1]       <NA>
  pkgdown          2.0.7        RSPM     <NA>   <NA>  [1]       <NA>
  pkgload          1.3.2        RSPM     <NA>   <NA>  [1]       <NA>
  praise           1.0.0        RSPM     <NA>   <NA>  [1]       <NA>
  processx         3.8.0        RSPM     <NA>   <NA>  [1]       <NA>
  promises       1.2.0.1        RSPM     <NA>   <NA>  [1]       <NA>
  ps               1.7.2        RSPM     <NA>   <NA>  [1]       <NA>
  purrr            1.0.1        RSPM     <NA>   <NA>  [1]       <NA>
  ragg             1.2.5        RSPM     <NA>   <NA>  [1]       <NA>
  rappdirs         0.3.3        RSPM     <NA>   <NA>  [1]   indirect
  rematch2         2.1.2        RSPM     <NA>   <NA>  [1]       <NA>
  renv         0.17.0-27      GitHub     <NA>   <NA>  [1]       <NA>
  rex              1.2.1        RSPM     <NA>   <NA>  [1]       <NA>
  rlang            1.0.6        RSPM     <NA>   <NA>  [1]   indirect
  rmarkdown         2.20        RSPM     <NA>   <NA>  [1]     direct
  rpart           4.1.19        CRAN     <NA>   <NA>  [1]       <NA>
  rprojroot        2.0.3        RSPM     <NA>   <NA>  [1]       <NA>
  rstudioapi        0.14        RSPM     <NA>   <NA>  [1]       <NA>
  sandpaper       0.11.7 carpentries     <NA>   <NA>  [1]       <NA>
  sass             0.4.5        RSPM     <NA>   <NA>  [1]   indirect
  servr             0.25        RSPM     <NA>   <NA>  [1]       <NA>
  sessioninfo      1.2.2        RSPM     <NA>   <NA>  [1]       <NA>
  spatial         7.3-15        CRAN     <NA>   <NA>  [1]       <NA>
  stats             <NA>        <NA>     <NA>   <NA>  [2]   indirect
  stringi         1.7.12        RSPM     <NA>   <NA>  [1]   indirect
  stringr          1.5.0        RSPM     <NA>   <NA>  [1]   indirect
  survival         3.4-0        CRAN     <NA>   <NA>  [1]       <NA>
  sys              3.4.1        RSPM     <NA>   <NA>  [1]       <NA>
  systemfonts      1.0.4        RSPM     <NA>   <NA>  [1]       <NA>
  testthat         3.1.6        RSPM     <NA>   <NA>  [1]       <NA>
  textshaping      0.3.6        RSPM     <NA>   <NA>  [1]       <NA>
  tibble           3.2.0        CRAN     <NA>   <NA>  [1]       <NA>
  tinkr       0.1.0.9000      GitHub     <NA>   <NA>  [1]       <NA>
  tinytex           0.44        RSPM     <NA>   <NA>  [1]   indirect
  tools             <NA>        <NA>     <NA>   <NA>  [2]   indirect
  usethis          2.1.6        RSPM     <NA>   <NA>  [1]       <NA>
  utf8             1.2.3        RSPM     <NA>   <NA>  [1]       <NA>
  utils             <NA>        <NA>     <NA>   <NA>  [2]   indirect
  varnish         0.2.14      GitHub     <NA>   <NA>  [1]       <NA>
  vctrs            0.5.2        RSPM     <NA>   <NA>  [1]   indirect
  waldo            0.4.0        RSPM     <NA>   <NA>  [1]       <NA>
  whisker          0.4.1        RSPM     <NA>   <NA>  [1]       <NA>
  withr            2.5.0        RSPM     <NA>   <NA>  [1]       <NA>
  xfun              0.37        RSPM     <NA>   <NA>  [1]   indirect
  xml2             1.3.3        RSPM     <NA>   <NA>  [1]       <NA>
  xslt             1.4.4        RSPM     <NA>   <NA>  [1]       <NA>
  yaml             2.3.7        RSPM     <NA>   <NA>  [1]   indirect
  zip              2.2.2        RSPM     <NA>   <NA>  [1]       <NA>
  
  [1]: /tmp/RtmpzoFKmi/RLIBS_1931164ef33f
  [2]: /opt/R/4.2.2/lib/R/library        
  
  # ABI ================================
  * No ABI conflicts were detected in the set of installed packages.
  
  # User Profile =======================
  [1] Source  Package Require Version Dev    
  <0 rows> (or 0-length row.names)
  
  # Settings ===========================
  List of 10
   $ bioconductor.version     : chr(0) 
   $ external.libraries       : chr(0) 
   $ ignored.packages         : chr(0) 
   $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo"
   $ r.version                : chr(0) 
   $ snapshot.type            : chr "implicit"
   $ use.cache                : logi TRUE
   $ vcs.ignore.cellar        : logi TRUE
   $ vcs.ignore.library       : logi TRUE
   $ vcs.ignore.local         : logi TRUE
  
  # Options ============================
  List of 8
   $ defaultPackages                     : chr [1:6] "datasets" "utils" "grDevices" "graphics" ...
   $ download.file.method                : NULL
   $ download.file.extra                 : NULL
   $ install.packages.compile.from.source: NULL
   $ pkgType                             : chr "source"
   $ repos                               : Named chr [1:3] "https://carpentries.r-universe.dev/" "https://carpentries.github.io/drat" "https://cran.rstudio.com/"
    ..- attr(*, "names")= chr [1:3] "carpentries" "carpentries_archive" "CRAN"
   $ renv.config.user.profile            : logi FALSE
   $ renv.verbose                        : logi TRUE
  
  # Environment Variables ==============
  HOME                       = /home/runner
  LANG                       = C.UTF-8
  MAKE                       = make
  RENV_CONFIG_CACHE_SYMLINKS = FALSE
  RENV_CONFIG_REPOS_OVERRIDE = https://packagemanager.posit.co/cran/__linux__/jammy/latest
  RENV_PATHS_ROOT            = /home/runner/.local/share/renv
  RENV_PATHS_SANDBOX         = /home/runner/work/_temp/sandbox/
  RENV_PROFILE               = lesson-requirements
  R_LIBS                     = /tmp/RtmpzoFKmi/RLIBS_1931164ef33f
  R_LIBS_SITE                = NULL
  R_LIBS_USER                = NULL
  
  # PATH ===============================
  - /home/runner/work/sandpaper/sandpaper/check/sandpaper.Rcheck/R_check_bin
  - /home/runner/.local/bin
  - /opt/pipx_bin
  - /home/runner/.cargo/bin
  - /home/runner/.config/composer/vendor/bin
  - /usr/local/.ghcup/bin
  - /home/runner/.dotnet/tools
  - /snap/bin
  - /usr/local/sbin
  - /usr/local/bin
  - /usr/sbin
  - /usr/bin
  - /sbin
  - /bin
  - /usr/games
  - /usr/local/games
  - /snap/bin
  
  # Cache ==============================
  There are a total of 114 package(s) installed in the renv cache.
  Cache path: "~/.local/share/renv/cache/v5/R-4.2/x86_64-pc-linux-gnu"

Do you have any advice of where I can look to debug?

@kevinushey
Copy link
Collaborator

Any chance you can share a reproducible example? The output of the following might also be useful:

find.packages("rmarkdown")
.libPaths()
renv:::renv_libpaths_user()
renv:::renv_libpaths_site()

And perhaps:

renv:::renv_hydrate_dependencies(getwd())
renv:::renv_hydrate_libpaths()

@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 8, 2023

Any chance you can share a reproducible example?

😅 I can only get it to trigger on R CMD check, so it's one of those awkward situations where I'm trying to pick up a grain of rice with chopsticks attached to baseball bats.

I'll insert those commands and see what output I can get.

zkamvar added a commit to carpentries/sandpaper that referenced this issue Mar 8, 2023
@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 9, 2023

That's.... interesting. Here's the output on r-devel:

  The following packages are used in this project, but not available locally:
  
  	rmarkdown
  
  renv will attempt to download and install these packages.
  
  * Hydrated 0 packages in 0.0055 milliseconds.
  
  ── renv diagnostics ────────────────────────────────────────────────────────────
  
  ── find.package ──
  
  [1] "/tmp/RtmpjB6CA6/RLIBS_1d2b6a5e5492/rmarkdown"
  ── libPaths() ──
  [1] "/tmp/RtmpjB6CA6/RLIBS_1d2b6a5e5492" "/opt/R/devel/lib/R/library"        
  
  ── renv_libpaths_user() ──
  [1] "NULL"
  
  ── renv_libpaths_site() ──
  character(0)
  
  ── renv_hydrate_dependencies() ──
  * Discovering package dependencies ... 
  Done!
  list()
  ── renv_hydrate_libpaths() ──
  
  [1] "NULL"                       "/opt/R/devel/lib/R/library"Recording changes in lockfile

for context, this is what I see on [kraftwerk voice] my home computer:

── renv diagnostics ────────────────────────────────────────────────────────────

── find.package ──

[1] "/home/zhian/R/library/rmarkdown"
── libPaths() ──

[1] "/home/zhian/R/library"         "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library"       "/usr/lib/R/library"
── renv_libpaths_user() ──

[1] "~/R/library"
── renv_libpaths_site() ──
[1] "/usr/local/lib/R/site-library/" "/usr/lib/R/site-library"
[3] "/usr/lib/R/library"

── renv_hydrate_dependencies() ──

* Discovering package dependencies ... Done!
list()
── renv_hydrate_libpaths() ──

[1] "/home/zhian/R/library"         "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library"       "/usr/lib/R/library"
[5] "/usr/lib/R/library"

@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 9, 2023

One more context that succeeds: R 4.0.5:

  ── renv diagnostics ────────────────────────────────────────────────────────────
  
  ── find.package ──
  
  [1] "/tmp/Rtmpz4ewKg/RLIBS_17bb13301fed/rmarkdown"
  ── libPaths() ──
  
  [1] "/tmp/Rtmpz4ewKg/RLIBS_17bb13301fed" "/opt/R/4.0.5/lib/R/library"        
  ── renv_libpaths_user() ──
  [1] "/tmp/Rtmpz4ewKg/RLIBS_17bb13301fed"
  
  ── renv_libpaths_site() ──
  character(0)
  
  ── renv_hydrate_dependencies() ──
  * Discovering package dependencies ... 
  Done!
  list()
  ── renv_hydrate_libpaths() ──
  [1] "/tmp/Rtmpz4ewKg/RLIBS_17bb13301fed" "/opt/R/4.0.5/lib/R/library"    

@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 9, 2023

OH HO HO HO!

I think it comes down to the environment variables. Somehow R_LIBS_SITE and R_LIBS_USER are getting set to "NULL" in R 4.2 and devel, but not in R 4.1 and 4.0:

From the failing run on R 4.2:

  # Environment Variables ==============
  HOME                       = /home/runner
  LANG                       = C.UTF-8
  MAKE                       = make
  RENV_CONFIG_CACHE_SYMLINKS = FALSE
  RENV_CONFIG_REPOS_OVERRIDE = https://packagemanager.posit.co/cran/__linux__/jammy/latest
  RENV_PATHS_ROOT            = /home/runner/.local/share/renv
  RENV_PATHS_SANDBOX         = /home/runner/work/_temp/sandbox/
  RENV_PROFILE               = lesson-requirements
  R_LIBS                     = /tmp/Rtmp7WIf4p/RLIBS_18f86d362a92
  R_LIBS_SITE                = NULL
  R_LIBS_USER                = NULL

And from a successful run on R 4.1

  # Environment Variables ==============
  HOME                       = /home/runner
  LANG                       = C.UTF-8
  MAKE                       = make
  RENV_CONFIG_CACHE_SYMLINKS = FALSE
  RENV_CONFIG_REPOS_OVERRIDE = https://packagemanager.posit.co/cran/__linux__/jammy/latest
  RENV_PATHS_ROOT            = /home/runner/.local/share/renv
  RENV_PATHS_SANDBOX         = /home/runner/work/_temp/sandbox/
  RENV_PROFILE               = lesson-requirements
  R_LIBS                     = /tmp/RtmpSLUECL/RLIBS_198d269846c4
  R_LIBS_SITE                = no_such_dir
  R_LIBS_USER                = 

zkamvar added a commit to carpentries/sandpaper that referenced this issue Mar 9, 2023
@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 9, 2023

I think the answer to this problem is to add || value == "NULL" to line 150:

renv/R/libpaths.R

Lines 143 to 156 in 31ae17a

renv_libpaths_user <- function() {
# if renv is active, the user library will be saved
envvars <- c("RENV_DEFAULT_R_LIBS_USER", "R_LIBS_USER")
for (envvar in envvars) {
value <- Sys.getenv(envvar, unset = NA)
if (is.na(value) || value == "<NA>" || !nzchar(value))
next
parts <- strsplit(value, .Platform$path.sep, fixed = TRUE)[[1]]
return(parts)
}

I've tested it on my machine and it has restored my ability to check.

Yes, it's hacky and doesn't really get into the root of the issue, but I honestly have no clue why R CMD check is doing things this way.

zkamvar added a commit to zkamvar/renv that referenced this issue Mar 9, 2023
In R CMD check for R >= 4.2, the environment variable R_LIBS_USER somehow gets set to the character NULL.

This is a bandaid for this. See rstudio#1161 (comment)
kevinushey pushed a commit that referenced this issue Mar 9, 2023
In R CMD check for R >= 4.2, the environment variable R_LIBS_USER somehow gets set to the character NULL.

This is a bandaid for this. See #1161 (comment)
@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 9, 2023

It's successful for R 4.0 and up! 🎉 Thank you for the help!

CI is still failing for R < 4.0... it appears to be setting the user lib to one that doesn't exist on the CI... at least it's different than the successful runs. Do you know why that may be?

── renv diagnostics ────────────────────────────────────────────────────────────

── find.package ──

[1] "/tmp/RtmpQWm9v6/RLIBS_1cf17adf5273/rmarkdown"
── libPaths() ──
[1] "/tmp/RtmpQWm9v6/RLIBS_1cf17adf5273" "/opt/R/3.6.3/lib/R/library"        

── renv_libpaths_user() ──
[1] "~/R/x86_64-pc-linux-gnu-library/3.6"

── renv_libpaths_site() ──
character(0)

── renv_hydrate_dependencies() ──
* Discovering package dependencies ... 
Done!
list()
── renv_hydrate_libpaths() ──

[1] "/home/runner/R/x86_64-pc-linux-gnu-library/3.6"
[2] "/opt/R/3.6.3/lib/R/library"      

@kevinushey
Copy link
Collaborator

Sorry, I don't know...

As a workaround, you can also try passing a custom sources argument to hydrate(), containing the location where your packages should be found?

@kevinushey
Copy link
Collaborator

I could also consider having hydrate() search the library paths as were set before renv were activated.

zkamvar added a commit to carpentries/sandpaper that referenced this issue Mar 9, 2023
@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 9, 2023

Sorry, I don't know...

As a workaround, you can also try passing a custom sources argument to hydrate(), containing the location where your packages should be found?

I am happy to report that this solution did indeed fix the remaining problems! 👯

@kevinushey, I cannot speak for the wider R community, but the time and dedication you put into {renv} has made a whole lot of reproducibility issues a lot easier to tackle. The fact that you were able to point me to the right tools to help debug this issue (despite my best efforts at complicating matters 🙈) shows how well-designed {renv} is as a flexible and sensible method for package management. Thank you so much for everything you do 🙌🏼

I could also consider having hydrate() search the library paths as were set before renv were activated.

I saw that you implemented this in c068880 and I can report that on re-running the job, it now works!

@zkamvar zkamvar closed this as completed Mar 9, 2023
@kevinushey
Copy link
Collaborator

Great news :-) Thank you for the kinds words; I'm glad that I'm able to play my part!

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

2 participants