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

packrat::snapshot fails looking for packages that aren't installed. #597

Open
rbpatt2019 opened this issue Apr 2, 2020 · 3 comments
Open

Comments

@rbpatt2019
Copy link

After starting a new project (devtools::create()), I initialised packrat (packrat::init()), then installed two packages - dplyr and Seurat. Upon calling packrat::snapshot(), I receive the following error:

[ins] r$> packrat::snapshot()
Error: Unable to retrieve package records for the following packages:
- 'testthat' 

Which is particularly confusing because:

[ins] r$> list.files(.libPaths())
  [1] "ape"          "askpass"      "assertthat"   "base"         "base64enc"    "bibtex"       "bitops"       "boot"         "caTools"      "class"        "cli"          "cluster"      "codetools"    "colorspace"
 [15] "compiler"     "cowplot"      "crayon"       "crosstalk"    "curl"         "data.table"   "datasets"     "digest"       "dplyr"        "ellipsis"     "fansi"        "farver"       "fitdistrplus" "FNN"
 [29] "foreign"      "future"       "future.apply" "gbRd"         "gdata"        "ggplot2"      "ggrepel"      "ggridges"     "globals"      "glue"         "gplots"       "graphics"     "grDevices"    "grid"
 [43] "gridExtra"    "gtable"       "gtools"       "hexbin"       "htmltools"    "htmlwidgets"  "httr"         "ica"          "igraph"       "irlba"        "isoband"      "jsonlite"     "KernSmooth"   "labeling"
 [57] "later"        "lattice"      "lazyeval"     "leiden"       "lifecycle"    "listenv"      "lmtest"       "lsei"         "magrittr"     "MASS"         "Matrix"       "MatrixModels" "metap"        "methods"
 [71] "mgcv"         "mime"         "mnormt"       "multcomp"     "munsell"      "mutoss"       "mvtnorm"      "nlme"         "nnet"         "npsurv"       "numDeriv"     "openssl"      "packrat"      "parallel"
 [85] "patchwork"    "pbapply"      "pillar"       "pkgconfig"    "plotly"       "plotrix"      "plyr"         "png"          "promises"     "purrr"        "quantreg"     "R6"           "RANN"         "RColorBrewer"
 [99] "Rcpp"         "RcppAnnoy"    "Rdpack"       "reshape2"     "reticulate"   "rlang"        "ROCR"         "rpart"        "RSpectra"     "rsvd"         "Rtsne"        "sandwich"     "scales"       "sctransform"
[113] "Seurat"       "sn"           "SparseM"      "spatial"      "splines"      "stats"        "stats4"       "stringi"      "stringr"      "survival"     "sys"          "tcltk"        "TFisher"      "TH.data"
[127] "tibble"       "tidyr"        "tidyselect"   "tools"        "tsne"         "utf8"         "utils"        "uwot"         "vctrs"        "viridisLite"  "withr"        "yaml"         "zoo"

Definitely does not have testthat as an entry or package.

I've tried a number of things recommended in similar issues (#511, #541), like removing and re-installing, or passing snapshot.sources = FALSE, or passing infer.dependencies = FALSE, but all result in the original error.

Apologies if I'm missing something super-basic, this is my first adventure with packrat!

@kevinushey
Copy link
Contributor

packrat::snapshot() uses the union of packages included in your project, as well as packages already installed in your library paths. This most likely implies that Packrat discovered you're using testthat somewhere in your project, and so wants to ensure that it is added to the lockfile.

FWIW, I would strongly encourage you to check out renv as an alternative to Packrat; the API is ultimately the same but should overall be faster, more robust, and report errors more clearly.

@rbpatt2019
Copy link
Author

@kevinushey Thanks for the advice. I'll check out renv, too. Feel free to consider this closed!

1 similar comment
@rbpatt2019
Copy link
Author

@kevinushey Thanks for the advice. I'll check out renv, too. Feel free to consider this closed!

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