Hi!
I'm absolutely new to renv
, and started to use today for the first time. Based on the Introduction to renv vignette, it seemed to be a viable alternative to conda
by creating isolated virtul environments, but it's doesn't seem to be doing what I expected it to do.
Setup
I created a new RStudio project, and chose to use renv
with it.
Inital contents of renv.lock
{
"R": {
"Version": "4.1.0",
"Repositories": [
{
"Name": "CRAN",
"URL": "https://cran.rstudio.com"
}
]
},
"Packages": {
"renv": {
"Package": "renv",
"Version": "0.13.2",
"Source": "Repository",
"Repository": "CRAN",
"Hash": "079cb1f03ff972b30401ed05623cbe92"
}
}
}
Then I installed the fpp3
package, and I was able to load it successfully.
> library(fpp3)
-- Attaching packages ------------------------------------------------ fpp3 0.4.0 --
v tibble 3.1.2 v tsibble 1.0.1
v dplyr 1.0.6 v tsibbledata 0.3.0
v tidyr 1.1.3 v feasts 0.2.2
v lubridate 1.7.10 v fable 0.3.1
v ggplot2 3.3.3
-- Conflicts ----------------------------------------------------- fpp3_conflicts --
x lubridate::date() masks base::date()
x dplyr::filter() masks stats::filter()
x tsibble::intersect() masks base::intersect()
x tsibble::interval() masks lubridate::interval()
x dplyr::lag() masks stats::lag()
x tsibble::setdiff() masks base::setdiff()
x tsibble::union() masks base::union()
Problem
I wanted a snapshot of this state, so tried for that, but renv
didn't allow it.
> renv::snapshot()
* The lockfile is already up to date.
And the renv.lock
file contents remained unchanged.
I considered the possibility that something is captured "somehow", and uninstalled fpp3
. Then if I called to restore it, obviously it did not, saying it's already up to date.
> .libPaths()
[1] "C:/Users/anirb/Desktop/fpp3/renv/library/R-4.1/x86_64-w64-mingw32"
[2] "C:/Users/anirb/AppData/Local/Temp/Rtmpao4McL/renv-system-library"
> utils::remove.packages("fpp3")
Removing package from ‘C:/Users/anirb/Desktop/fpp3/renv/library/R-4.1/x86_64-w64-mingw32’
(as ‘lib’ is unspecified)
> library(fpp3)
Error in library(fpp3) : there is no package called ‘fpp3’
> renv::restore()
* The library is already synchronized with the lockfile.
Question
Is this behaviour expected? If so, can someone please explain what is the point of using renv
if I can't take a snapshot when I choose to do it? If not, what can I do to fix this?
Session Info
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=English_India.1252 LC_CTYPE=English_India.1252
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C
[5] LC_TIME=English_India.1252
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0 renv_0.13.2
Thanks.