-
Notifications
You must be signed in to change notification settings - Fork 153
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
failed to add "xtable" to renv.lock
after copying cache to project library with renv::isolate()
and reinstall + snapshot
#208
Comments
Now I just restarted R, reinstalled with library(renv)
#>
#> Attaching package: 'renv'
#> The following object is masked from 'package:stats':
#>
#> update
#> The following objects are masked from 'package:utils':
#>
#> history, upgrade
#> The following objects are masked from 'package:base':
#>
#> load, remove
isolate()
purge("xtable")
#> * The requested package is not installed in the cache -- nothing to do.
install("xtable")
#> Retrieving 'https://cloud.r-project.org/src/contrib/xtable_1.8-4.tar.gz' ...
#> OK [file is up to date]
#> Installing xtable [1.8-4] from CRAN ...
#> OK (built from source)
.libPaths()
#> [1] "/media/ssd/nas-ethz/doktorat/projects/01_spectroscopy/52_swr-spc/renv/library/R-3.6/x86_64-pc-linux-gnu"
#> [2] "/tmp/RtmpGYUwmf/renv-system-library"
#> [3] "/usr/lib/R/library" Created on 2019-10-06 by the reprex package (v0.3.0) renv should't use the cache for this project (this command failed in > renv::settings$use.cache()
[1] FALSE
> renv::snapshot()
* The lockfile is already up to date. However, using library(renv)
#>
#> Attaching package: 'renv'
#> The following object is masked from 'package:stats':
#>
#> update
#> The following objects are masked from 'package:utils':
#>
#> history, upgrade
#> The following objects are masked from 'package:base':
#>
#> load, remove
snapshot()
#> The following required packages are not installed:
#>
#> reshape [required by GGally]
#> reshape2 [required by broom, caret, Cubist, and 2 others]
#> rio [required by car]
#> robCompositions [required by mvoutlier]
#> robustbase [required by cvTools, fpc, mvoutlier]
#> rprojroot [required by here]
#> scales [required by cowplot, ggplot2]
#> sgeostat [required by mvoutlier]
#> sp [required by maptools]
#> SparseM [required by quantreg]
#> SQUAREM [required by lava]
#> testthat [required by hyperSpec]
#> tibble [required by broom, cellranger, dbplyr, and 10 others]
#> tidyr [required by broom, modelr, recipes, and 2 others]
#> tidyselect [required by dbplyr, dplyr, recipes, and 2 others]
#> tidyverse [required by simplerspec]
#> timeDate [required by recipes]
#> vctrs [required by hms, pillar]
#> viridisLite [required by ggplot2]
#> XML [required by hyperSpec]
#> zoo [required by lmtest]
#>
#> Consider re-installing these packages before snapshotting the lockfile.
#> Error in snapshot(): aborting snapshot due to pre-flight validation failure Created on 2019-10-06 by the reprex package (v0.3.0) Am I missing anything? |
renv::isolate()
fails to copy renv from cache to project libraryrenv.lock
after copying cache to project library with renv::isolate()
and reinstall and snapshot
renv.lock
after copying cache to project library with renv::isolate()
and reinstall and snapshotrenv.lock
after copying cache to project library with renv::isolate()
and reinstall + snapshot
I don't quite follow -- these concepts are somewhat independent. Packages enter the lockfile if they are (1) installed in the project library, and (2) used somewhere in the project. Packages installed in the library may either be 'real' package installs, or may be symlinks back into the The error you reported looks like a bug in |
My best guess: the Note that here:
I would not expect to see |
Thanks for the clarification. Sorry for my wrong statement. I somehow accidentally confused things because renv was not behaving as expected, although key design principles (1) and (2) can be deduced from the renv introduction. Maybe an explicit "symlink" mention could be incorporated into this starting resource? I just upgraded to renv v0.7.0-129 using > renv::upgrade(version = "0.7.0-129")
A new version of the renv package will be installed:
[0.6.0-61] -> [0.7.0-129]
This project will use the newly-installed version of renv. I'm not sure if this bug was actually related to the problem described here, but nice you fixed that anyway! I checked again and "xtable" is located in the renv project library, but still not in > renv::install("xtable")
Retrieving 'https://cloud.r-project.org/src/contrib/xtable_1.8-4.tar.gz' ...
OK [file is up to date]
Installing xtable [1.8-4] ...
OK (built from source)
> renv::snapshot()
* The lockfile is already up to date. Also, xtable is used in the R scripts in the project directory used for
Correct, in the project directory I get: > .libPaths()
[1] "/media/ssd/nas-ethz/doktorat/projects/01_spectroscopy/52_swr-spc/renv/library/R-3.6/x86_64-pc-linux-gnu"
[2] "/tmp/RtmpQwcIHo/renv-system-library" Is this really inteded behaviour of BTW Thanks a lot for your help! |
In essence, packages will enter the lockfile if they're reported as part of the packages in:
I suspect that some packages are being used in your project in a way that The behavior with |
Ah I see, as you say that might indeed be related to the way I load packages; here is the ## Load packages
pkgs <- c("here", "drake", "tidyverse", "data.table",
"simplerspec", "caret", "Cubist", "rsample", "nls.multstart",
"broom", # modeling
"future", "future.apply", "doParallel", "doFuture", # asynchronous computation
"gghighlight", "grid", "gridExtra", "cowplot", # graphics
"xtable") # tables
purrr::walk(pkgs, library, character.only = TRUE) Also, as an example of a script of the workflow Let me know if you want to see the rest of the project (cannot share the data publicly as I don't own, but could invite you to the private repo). |
That would explain it! Unfortunately If you rewrite your package usages with another form, e.g. plain old
then |
If I getwd()
.libPaths() inside an renv-using project, I see: getwd()
#> [1] "/private/var/folders/yx/3p5dt4jj1019st0x90vhm9rr0000gn/T/RtmpVGI5y1/reprexecfb5cc375e3"
.libPaths()
#> [1] "/Users/jenny/rrr/stat545/renv/library/R-3.6/x86_64-apple-darwin15.6.0"
#> [2] "/private/var/folders/yx/3p5dt4jj1019st0x90vhm9rr0000gn/T/RtmpVGI5y1/renv-system-library"
#> [3] "/Library/Frameworks/R.framework/Versions/3.6/Resources/library" Created on 2019-10-07 by the reprex package (v0.3.0) Which seems correct. @philipp-baumann Can you say more about what you're seeing? |
Sure, that makes sense. Thanks! This now works :-) (maybe nice for a future version; I'd have to dig in more into the code base of renv to be able to contribute with code; maybe some time in future) > renv::snapshot()
The following package(s) will be updated in the lockfile:
# CRAN ===============================
- xtable [* -> 1.8-4]
Do you want to proceed? [y/N]: y
* Lockfile written to '/media/ssd/nas-ethz/doktorat/projects/01_spectroscopy/52_swr-spc/renv.lock'. |
Thanks for jumping in @jennybc Here is what I see: getwd()
#> [1] "/tmp/Rtmphm0Ct4/reprexeed9548c51"
.libPaths()
#> [1] "/media/ssd/nas-ethz/doktorat/projects/01_spectroscopy/52_swr-spc/renv/library/R-3.6/x86_64-pc-linux-gnu"
#> [2] "/tmp/Rtmphm0Ct4/renv-system-library"
#> [3] "/usr/lib/R/library" Created on 2019-10-07 by the reprex package (v0.3.0) |
The point is that the default system library (
should not be there when the |
It looks like which intentionally does not load the |
But the project's |
The docs for |
I believe this is because
But |
Perhaps more to the point:
|
I can imagine how to create something worthy of the name |
I think the underlying issue here is now understood + resolved ( Also worth stating:
In that example, the function
and in this case |
Great, thanks @kevinushey and @jennybc for digging into it and giving detailed infos! |
Dear Kevin,
I'm a big fan of renv and I'm using it in combination with drake and Docker to ensure reproducibility for my scientific projects and foster collaboration. I'm at the moment experimenting with the Docker configuration option 1 you nicely describe in Using renv with Docker. Because some of the packages are shared via cache and not in the project library, they are not listed in
renv.lock
. As a consequence, they were not installed when building the Docker image.To this purpose I tried using
renv::isolate()
introduced in 4ca213faf29eabc1a38fc24f8f6d51f9a5d7ce27 to move these packages to the project library. I executed this on my local machine to prepare the newrenv.lock
for Docker.Unfortunately, it failed and I couldn't figure out why it cannot move renv:
Created on 2019-10-06 by the reprex package (v0.3.0)
I'm using renv v0.7.0-111, which I also installed in the global library of my local machine.
I have the following in my
.Rprofile
:The Dockerfile is in this gist.
Thanks a lot for the great work done here and some hints to resolve the issue.
Best, Philipp
The text was updated successfully, but these errors were encountered: