rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
998 stars 152 forks source link

Empty renv.lock file after upgrade and snapshot. #604

Closed krumsiek closed 3 years ago

krumsiek commented 3 years ago

I just upgraded to the new 0.12.3-67 using renv::upgrade() in my project. I then ran renv::snapshot() again since renv said my lock file is out of sync. However, after that operation, renv.lock is basically empty, with just renv itself in there. See below also the log from the snapshot command:

> renv::snapshot()
The following package(s) will be updated in the lockfile:

# Bioconductor =======================
- BiocGenerics     [0.32.0 -> *]
- BiocParallel     [1.20.1 -> *]
- BiocVersion      [3.10.1 -> *]
- RCy3             [2.6.3 -> *]
- graph            [1.64.0 -> *]

# CRAN ===============================
- BH               [1.72.0-3 -> *]
- BiocManager      [1.30.10 -> *]
- DBI              [1.1.0 -> *]
- Formula          [1.2-4 -> *]
- GeneNet          [1.2.15 -> *]
- Hmisc            [4.4-2 -> *]
- MASS             [7.3-51.6 -> *]
- Matrix           [1.2-18 -> *]
- MatrixModels     [0.4-1 -> *]
- R.methodsS3      [1.8.1 -> *]
- R.oo             [1.24.0 -> *]
- R.utils          [2.10.1 -> *]
- R6               [2.5.0 -> *]
- RColorBrewer     [1.1-2 -> *]
- RJSONIO          [1.3-1.4 -> *]
- Rcpp             [1.0.5 -> *]
- RcppArmadillo    [0.9.900.2.0 -> *]
- RcppEigen        [0.3.3.9.1 -> *]
- Rdpack           [2.1 -> *]
- SparseM          [1.78 -> *]
- XML              [3.99-0.3 -> *]
- abind            [1.4-5 -> *]
- askpass          [1.1 -> *]
- assertthat       [0.2.1 -> *]
- backports        [1.2.1 -> *]
- base64enc        [0.1-3 -> *]
- blob             [1.2.1 -> *]
- boot             [1.3-25 -> *]
- brio             [1.1.0 -> *]
- broom            [0.7.3 -> *]
- callr            [3.5.1 -> *]
- car              [3.0-9 -> *]
- carData          [3.0-4 -> *]
- cellranger       [1.1.0 -> *]
- checkmate        [2.0.0 -> *]
- cli              [2.2.0 -> *]
- clipr            [0.7.1 -> *]
- cluster          [2.1.0 -> *]
- colorspace       [2.0-0 -> *]
- conquer          [1.0.1 -> *]
- corpcor          [1.6.9 -> *]
- corrplot         [0.84 -> *]
- cowplot          [1.0.0 -> *]
- cpp11            [0.2.4 -> *]
- crayon           [1.3.4 -> *]
- curl             [4.3 -> *]
- data.table       [1.13.4 -> *]
- dbplyr           [2.0.0 -> *]
- desc             [1.2.0 -> *]
- diffobj          [0.3.2 -> *]
- digest           [0.6.27 -> *]
- dplyr            [1.0.2 -> *]
- ellipsis         [0.3.1 -> *]
- evaluate         [0.14 -> *]
- fansi            [0.4.1 -> *]
- farver           [2.0.3 -> *]
- fdrtool          [1.2.15 -> *]
- forcats          [0.5.0 -> *]
- foreign          [0.8-76 -> *]
- formatR          [1.7 -> *]
- fs               [1.5.0 -> *]
- futile.logger    [1.4.3 -> *]
- futile.options   [1.0.1 -> *]
- gbRd             [0.4-11 -> *]
- generics         [0.1.0 -> *]
- ggplot2          [3.3.2 -> *]
- ggpubr           [0.4.0 -> *]
- ggrepel          [0.9.0 -> *]
- ggsci            [2.9 -> *]
- ggsignif         [0.6.0 -> *]
- glue             [1.4.2 -> *]
- gridExtra        [2.3 -> *]
- gtable           [0.3.0 -> *]
- haven            [2.3.1 -> *]
- highr            [0.8 -> *]
- hms              [0.5.3 -> *]
- htmlTable        [2.1.0 -> *]
- htmltools        [0.5.0 -> *]
- htmlwidgets      [1.5.3 -> *]
- httr             [1.4.2 -> *]
- igraph           [1.2.6 -> *]
- isoband          [0.2.3 -> *]
- jpeg             [0.1-8.1 -> *]
- jsonlite         [1.7.2 -> *]
- knitr            [1.30 -> *]
- labeling         [0.4.2 -> *]
- lambda.r         [1.2.4 -> *]
- lattice          [0.20-41 -> *]
- latticeExtra     [0.6-29 -> *]
- lifecycle        [0.2.0 -> *]
- lme4             [1.1-26 -> *]
- longitudinal     [1.1.12 -> *]
- lubridate        [1.7.9.2 -> *]
- magrittr         [2.0.1 -> *]
- maptools         [1.0-1 -> *]
- markdown         [1.1 -> *]
- matrixStats      [0.57.0 -> *]
- mgcv             [1.8-31 -> *]
- mime             [0.9 -> *]
- minqa            [1.2.4 -> *]
- modelr           [0.1.8 -> *]
- munsell          [0.5.0 -> *]
- nlme             [3.1-148 -> *]
- nloptr           [1.2.2.2 -> *]
- nnet             [7.3-14 -> *]
- openssl          [1.4.3 -> *]
- openxlsx         [4.2.3 -> *]
- pbkrtest         [0.4-8.6 -> *]
- pillar           [1.4.7 -> *]
- pkgbuild         [1.2.0 -> *]
- pkgconfig        [2.0.3 -> *]
- pkgload          [1.1.0 -> *]
- png              [0.1-7 -> *]
- polynom          [1.4-0 -> *]
- praise           [1.0.0 -> *]
- prettyunits      [1.1.1 -> *]
- processx         [3.4.5 -> *]
- progress         [1.2.2 -> *]
- ps               [1.5.0 -> *]
- purrr            [0.3.4 -> *]
- quantreg         [5.61 -> *]
- rbibutils        [2.0 -> *]
- readr            [1.4.0 -> *]
- readxl           [1.3.1 -> *]
- rematch          [1.0.1 -> *]
- rematch2         [2.1.2 -> *]
- reprex           [0.3.0 -> *]
- rio              [0.5.16 -> *]
- rlang            [0.4.9 -> *]
- rmarkdown        [2.6 -> *]
- rpart            [4.1-15 -> *]
- rprojroot        [2.0.2 -> *]
- rstatix          [0.6.0 -> *]
- rstudioapi       [0.13 -> *]
- rvest            [0.3.6 -> *]
- scales           [1.1.1 -> *]
- selectr          [0.4-2 -> *]
- snow             [0.4-3 -> *]
- sp               [1.4-2 -> *]
- statmod          [1.4.35 -> *]
- stringi          [1.5.3 -> *]
- stringr          [1.4.0 -> *]
- survival         [3.2-3 -> *]
- sys              [3.4 -> *]
- testthat         [3.0.1 -> *]
- tibble           [3.0.4 -> *]
- tidyr            [1.1.2 -> *]
- tidyselect       [1.1.0 -> *]
- tidyverse        [1.3.0 -> *]
- tinytex          [0.28 -> *]
- utf8             [1.1.4 -> *]
- vctrs            [0.3.6 -> *]
- viridis          [0.5.1 -> *]
- viridisLite      [0.3.0 -> *]
- waldo            [0.2.3 -> *]
- whisker          [0.4 -> *]
- withr            [2.3.0 -> *]
- xfun             [0.19 -> *]
- xml2             [1.3.2 -> *]
- yaml             [2.2.1 -> *]
- zip              [2.1.1 -> *]

# GitHub =============================
- MoDentify        [krumsieklab/MoDentify@HEAD -> *]

Do you want to proceed? [y/N]: y
kevinushey commented 3 years ago

Can you share your project sources?

krumsiek commented 3 years ago

Hi Kevin.

This is now difficult to reproduce for me, since I've been meddling around with renv in the project. (removed it etc.)

The same happens when I do this:

I seems that the activation process in this cases makes renv "forget" which packages it parsed for the project?

Not sure if this version is intended behavior though. The original report was odd since it was a project with renv already activated, I just did the upgrade.

krumsiek commented 3 years ago

Another version of the issue that I think can be reproduced:

It asks to create a library that is way too short (it should be dozens of packages).

> renv::activate()
* Project '~/work/git/renv_testing' loaded. [renv 0.12.3-67]
> renv::snapshot()
The following package(s) will be updated in the lockfile:

# CRAN ===============================
- MASS       [* -> 7.3-51.6]
- Matrix     [* -> 1.2-18]
- cluster    [* -> 2.1.0]
- foreign    [* -> 0.8-76]
- lattice    [* -> 0.20-41]
- mgcv       [* -> 1.8-31]
- nlme       [* -> 3.1-148]
- nnet       [* -> 7.3-14]
- rpart      [* -> 4.1-15]
- survival   [* -> 3.2-3]
kevinushey commented 3 years ago

renv::snapshot() will ultimately just capture whatever happens to be in your project library; I wonder if the library path was unexpectedly changed, or those packages were removed?

I believe you could "repair" this state by calling:

renv::install()
renv::snapshot()
krumsiek commented 3 years ago

Yes, I think this might be a misunderstanding of the renv functionality on my end. renv::init() seems to be the one that parses all dependencies from my code files.

My confusion was that I thought renv does all dependency parsing automatically at all times. For example, I now added a new library, but only as a library call in my code file, without doing anything else. renv::snapshot will not see that, as you said. renv::init and then discard and reinitialize added that package to the lockfile.

I never explicitly worked with the Project Library in RStudio.

kevinushey commented 3 years ago

If you haven't seen it already, https://rstudio.github.io/renv/articles/renv.html should be a good introduction. renv::snapshot() basically just saves the state of your library to the lockfile renv.lock; renv::restore() is the reverse operation.

krumsiek commented 3 years ago

I did see it, but apparently didn't fully get it. Thanks for the clarification and the great package.

kevinushey commented 3 years ago

No worries; thanks for the question! I hope you find the package useful.