CredibilityLab / groundhog

Reproducible R Scripts Via Date Controlled Installing & Loading of CRAN & Git Packages
https://groundhogr.com/
GNU General Public License v3.0
78 stars 4 forks source link

unintelligible error: DESCRIPTION files missing or broken #114

Closed HedvigS closed 8 months ago

HedvigS commented 8 months ago

Hello! Love the idea, but having weird problem. Here's my code:

### loading packages

groundhog_date <- "2024-01-17"

if(!("groundhog" %in% rownames(installed.packages()))){

  install.packages("groundhog")
  library(groundhog)

}else{

  library(groundhog)

}

groundhog_dir <- paste0("groundhog_libraries_", groundhog_date)

if(!dir.exists(groundhog_dir)){
  dir.create(groundhog_dir)
}

groundhog::set.groundhog.folder(groundhog_dir)

pkgs <- c("dplyr",
          "readr",
          "tidyr",
          "stringr",
          "ggplot2",
          "ggpubr",
          "udpipe",
          "reshape2",
          "tibble")

groundhog.library(pkgs, groundhog_date)

Here's what happens next:

> groundhog.library("dplyr", groundhog_date)
Error in x$Version : $ operator is invalid for atomic vectors
In addition: There were 32 warnings (use warnings() to see them)

> warnings()
Warning messages:
1: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'Matrix' is missing or broken
2: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'gtable' is missing or broken
3: In FUN(X[[i]], ...) : DESCRIPTION file of package 'dplyr' is missing or broken
4: In FUN(X[[i]], ...) : DESCRIPTION file of package 'Rcpp' is missing or broken
5: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'scales' is missing or broken
6: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'lattice' is missing or broken
7: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'ggplot2' is missing or broken
8: In FUN(X[[i]], ...) : DESCRIPTION file of package 'rlang' is missing or broken
9: In FUN(X[[i]], ...) : DESCRIPTION file of package 'utf8' is missing or broken
10: In FUN(X[[i]], ...) : DESCRIPTION file of package 'cli' is missing or broken
11: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'lifecycle' is missing or broken
12: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'vctrs' is missing or broken
13: In FUN(X[[i]], ...) : DESCRIPTION file of package 'glue' is missing or broken
14: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'data.table' is missing or broken
15: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'fansi' is missing or broken
16: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'purrr' is missing or broken
17: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'Matrix' is missing or broken
18: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'gtable' is missing or broken
19: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'dplyr' is missing or broken
20: In FUN(X[[i]], ...) : DESCRIPTION file of package 'Rcpp' is missing or broken
21: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'scales' is missing or broken
22: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'lattice' is missing or broken
23: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'ggplot2' is missing or broken
24: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'rlang' is missing or broken
25: In FUN(X[[i]], ...) : DESCRIPTION file of package 'utf8' is missing or broken
26: In FUN(X[[i]], ...) : DESCRIPTION file of package 'cli' is missing or broken
27: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'lifecycle' is missing or broken
28: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'vctrs' is missing or broken
29: In FUN(X[[i]], ...) : DESCRIPTION file of package 'glue' is missing or broken
30: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'data.table' is missing or broken
31: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'fansi' is missing or broken
32: In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'purrr' is missing or broken

I do not understand. What is going wrong when groundhogr is fetching the description files of these packages? Did they not exist on CRAN at the date?

HedvigS commented 8 months ago

In an effort to find a workaround, I used a function of my own that just installs uninstalled packages and loads everything. Through error messages there, I found that I ought to add "utf8", "Rcpp", "plyr", "data.table" to the pkgs-vector. When I did that, and then used groundhogr again it worked... but I don't know why.

Could someone explain to me what is happening?

urisohn commented 8 months ago

Hi

  1. Can you confirm the version of groundhog you are using and the operating system?
  2. Did you try, before the workaround, just running the groundhog command again as is?
  3. Is your groundhog dir on dropbox or similar?

This may be a bug in a new cache system introduced with groundhog 3.2 which makes loading of installed pkgs faster, but to chase it down need to make sure that's the version of groundhog in which it occurred.

urisohn commented 8 months ago

FWIW, the top part of your code could be simplified to just this i think:

if (!'groundhog' %in% installed.packages()) install.packages('groundhog')
library('groundhog')

and, set.groundhog.library() creates the folder, no need to do that either.

one more thing, no need to create separate groundhog folders each time. groundhog can save different versions of the same pkg side-by-side

Sorry, as i try to reproduce the error (i haven't been able to) i notice more things

HedvigS commented 8 months ago

Hi

  1. Can you confirm the version of groundhog you are using and the operating system?

groundhog 3.1.0 mac os Ventura 13.4.1 (c) Rstudio 023.12.1+402 (2023.12.1+402) R version 4.3.2 (2023-10-31)

  1. Did you try, before the workaround, just running the groundhog command again as is?

I'm not sure what you mean, I tried running the script bit by bit several times.

  1. Is your groundhog dir on dropbox or similar?

No. It's just in a git-folder, but no Nextcloud, dropbox, owncloud or anything like that on top.

This may be a bug in a new cache system introduced with groundhog 3.2 which makes loading of installed pkgs faster, but to chase it down need to make sure that's the version of groundhog in which it occurred.

HedvigS commented 8 months ago

FWIW, the top part of your code could be simplified to just this i think:

if (!'groundhog' %in% installed.packages()) install.packages('groundhog')
library('groundhog')

and, set.groundhog.library() creates the folder, no need to do that either.

one more thing, no need to create separate groundhog folders each time. groundhog can save different versions of the same pkg side-by-side

I don't create a new folder each time with dir.create, only if it doesn't exist. i set groundhog folder though, that seems necessary. That's good to know it'd create the folder if it didn't exist, i didn't know that.

Sorry, as i try to reproduce the error (i haven't been able to) i notice more things

urisohn commented 8 months ago

oh, if you have groundhog v3.1 I think that's related to a bug that has been fixed already, if you update groundhog I think you will be fine, but let me know otherwise.

HedvigS commented 8 months ago

oh, if you have groundhog v3.1 I think that's related to a bug that has been fixed already, if you update groundhog I think you will be fine, but let me know otherwise.

Aha, alright. Will do!