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

Can't open URL leading to cran.toc.rds #80

Closed CharlyMarie closed 2 years ago

CharlyMarie commented 2 years ago

Dear all :)

First, thanks for the great package !

After installing and loading GroundHog, I wrap my packages like this : load.lib <- c('dplyr', 'tidyr')

I then call groundhog.library(load.lib, '2022-07-01') and get that response :

_groundhog says: The date you entered, '2022-07-01' requires updating your local database with the list of all CRAN package-versions (cran.toc.rds) trying URL 'https://groundhogR.com/cran.toc.rds' Error in utils::download.file(paste0(groundhogR.url, rdsk), file.path(gf, : cannot open URL 'https://groundhogR.com/cran.toc.rds' In addition: Warning message: In utils::download.file(paste0(groundhogR.url, rdsk), file.path(gf, : URL 'https://groundhogR.com/cran.toc.rds': status was 'Couldn't resolve host name' trying URL 'https://s3.wasabisys.com/groundhog/cran.toc.rds' Error in utils::download.file(paste0(wasabi.url, rdsk), file.path(gf, : cannot open URL 'https://s3.wasabisys.com/groundhog/cran.toc.rds' In addition: Warning message: In utils::download.file(paste0(wasabi.url, rdsk), file.path(gf, : URL 'https://s3.wasabisys.com/groundhog/cran.toc.rds': status was 'Couldn't resolve host name' Error in load.cran.toc(TRUE) : Error. Groundhog says: could not download "cran.toc.rds' Error in gzfile(file, "rb") : cannot open the connection In addition: Warning message: In gzfile(file, "rb") : cannot open compressed file 'C:/Users/icma9270/Documents/R_groundhog/groundhoglibrary//cran.toc.rds', probable reason 'No such file or directory'

I tried to manually access the URL https://groundhogR.com/cran.toc.rds and copy-paste the file in the right folder. I do manage to do so, but R seems to erase the file each time I run the code. Which brings me back to the same problem : _cannot open compressed file 'C:/Users/icma9270/Documents/R_groundhog/groundhoglibrary//cran.toc.rds', probable reason 'No such file or directory'

Has any of you been there ?

Thanks for the help :)

urisohn commented 2 years ago

Have not seen this before. I am surprised that you would simultaneously have issues connecting to the file online and also locally in your computer. Few things to try, feel free to combine as appropriate.

  1. Silly but sometimes it works: restarting the computer...

  2. Directly ask for the database to be updated groundhog:::load.cran.toc(TRUE) (yes, that's three ::: not the usual two ::)

  3. Set another folder as your groundhog folder, one you know you have permissions to make changes to. set.groundhog.folder(<new path>) Then try again to load the package.

  4. Try downloading the file with R from a script, see what output it generates, so running something like: utils::download.file('https://groundhogr.com/cran.toc.rds', 'c:/temp/TEST_cran.toc.rds') modifying the 'c:/temp' to make sure it exists and that you have permission to save there

  5. Download the cran.toc.rds file with your browser (or with step 4 above it if works), save it somewhere in your computer. Then try to read it with R. Something liketest_cran.toc <- readRDS('c:/temp/TEST_cran.toc.rds')

Let's see if one of these leads us to the root cause.

CharlyMarie commented 2 years ago

Thanks !

I tried :

  1. To restart. Did not change anything ;
  2. To update the database. Got a "Error in groundhog:::load.cran.toc(TRUE) : Error. Groundhog says: could not download "cran.toc.rds'" error
  3. To set another folder. It did not change a thing ;
  4. To download the file with R from the script, and locate it in "C:/Users/icma9270/Documents/R_groundhog/groundhog_library//cran.toc.rds" which is where GoundHog is looking for it. It did download the file, but I still get the same error running the same command line ;
  5. To download the file in my browser an read it with R. I managed to do both, but the package still goes for the same error ;
urisohn commented 2 years ago

OK. Can you tell me a bit more about 4? Do you mean that after saving it, when you try to run groundhog it still outputs: cannot open compressed file 'C:/Users/icma9270/Documents/R_groundhog/groundhog_library//cran.toc.rds',?

Can you try the following things:

  1. Run an older version of groundhog: meta.groundhog('2022-06-01') then load any pkg, for instance groundhog.library('pwr','2022-06-01')

  2. Try reading the rds file you downloaded with utils:: outside of groundhog, so just do cran.toc<-readRDS("C:/Users/icma9270/Documents/R_groundhog/groundhog_library//cran.toc.rds")

  3. Can you tell me which versions of R, R Studio and Windows you are using?

Thank you

ps: after replying and re-reading your message, I guess you tried the equivalent of 7 already, and you do successfully read the file into R?

CharlyMarie commented 2 years ago

Thanks for the help !

After trying all of those options, it appeared that R could not access any repository through GroundHog (CRAN, the groundhog website...). I disabled my VPN, which is otherwise automatically loaded, and managed to load the packages with Groundhog.

Many thanks, hope it will be helpful for other people !

urisohn commented 2 years ago

OK, glad it is resolved. To try to make groundhog robust to this issue, do you mind sharing which VPN you were using?

CharlyMarie commented 2 years ago

Sure ! It is Pulse Secure : https://www.pulsesecure.net/

urisohn commented 2 years ago

Thanks!