JGCRI / gcamdata

The GCAM data system
https://jgcri.github.io/gcamdata/
Other
43 stars 26 forks source link

Issue: Unable to restore "renv" package in gcam data R - Project. #1249

Closed ARITRABANDOPADHYAY closed 9 months ago

ARITRABANDOPADHYAY commented 11 months ago

I am trying to install GCAM following the steps provided in the official video released for GCAM V6. I am facing a boot strapping error when i restart the R session after using renv::restore(packages = "renv") comand to install renv from project library.

# Bootstrapping renv ${VERSION} ---------------------------------------------- Error in bootstrap(version, libpath) : failed to download renv ${VERSION} is the error i am getting.

N.B. In the renv folder within GCAM Library folder is not created, rather i can see a folder named "staging" which i have not seen earlier

ARITRABANDOPADHYAY commented 10 months ago

Can anyone help me with this issue.

pkyle commented 10 months ago

I haven't seen this specific error before, though I don't use renv. People find it useful for prescribing and loading a set of package versions that are known to work, but it crashes things for me, and because it's not necessary anyways I've never worried about it. Anyway it seems that it's not installed, so rather than relying on gcamdata to perform the installation, you could just try, from the console window of Rstudio: install.packages("renv") And if you have the package installed but don't want to use it in gcamdata, you can key in, to your console: renv::deactivate() Then renv will no longer be used in that GCAM workspace. Of course then you'd need to make sure that you have compatible versions of all of the packages.

ARITRABANDOPADHYAY commented 10 months ago

Hello @pkyle, I would like to try without using renv, but how can I download and install all the specific versions of the packages. It's a long list of packages and also mostly older versions.

If you want to take a look at the issue I can setup a meeting and give you access to my computer.

bpbond commented 10 months ago

Hopefully this is useful: https://stackoverflow.com/questions/17082341/installing-older-version-of-r-package

ARITRABANDOPADHYAY commented 10 months ago

Thank you @bpbond , can you or @pkyle give me more details on how to properly setup gcam data without renv. I think without renv, project library will not be created.

pkyle commented 10 months ago

For installing specific package versions, I use the install_version() function of the devtools package. The link that @bpbond sent had a few more options if that doesn't work. I'll copy below the full list of packages and their versions that I have locally, but most of them are dependencies that get automatically installed when you install the packages whose functions we actually use in gcamdata. Incidentally for a full list of those functions, just see the NAMESPACE within the gcamdata folder. Here's the full list, sorted alphabetically: assertthat_0.2.1 brio_1.1.3 cachem_1.0.6 callr_3.7.3 cli_3.4.1 compiler_4.2.2 crayon_1.5.2 data.table_1.14.4 desc_1.4.2 devtools_2.3.1 dplyr_1.0.10 ellipsis_0.3.2 fansi_1.0.3 fastmap_1.1.0 fs_1.5.2 generics_0.1.3 glue_1.6.2 hms_1.1.2 lifecycle_1.0.3 magrittr_2.0.3 memoise_2.0.1 pillar_1.8.1 pkgbuild_1.3.1 pkgconfig_2.0.3 pkgload_1.3.1 prettyunits_1.1.1 processx_3.8.0 ps_1.7.2 purrr_1.0.1 R6_2.5.1 readr_2.1.3 remotes_2.4.2 rlang_1.1.0 rprojroot_2.0.3 rstudioapi_0.14 sessioninfo_1.2.2 stringi_1.7.8 stringr_1.5.0 tibble_3.1.8 tidyr_1.3.0 tidyselect_1.2.0 tools_4.2.2 tzdb_0.3.0 usethis_1.6.0 utf8_1.2.2 vctrs_0.6.2 withr_2.5.0 But really I think you can just install devtools, and use its install_version function to install those specific versions of dplyr, purrr, readr, stringr, tibble, and tidyr. All other relevant package version numbers will likely be set by that installation.

ARITRABANDOPADHYAY commented 10 months ago

Thanks @pkyle, so am i going to install the packages into the R library, or in a project library (as it is done incase of renv). If need to put it in a specific project library, then how to do it.

pkyle commented 10 months ago

The instructions I provided relate to installing specific package versions into the general R library. For project-specific libraries I have no info or experience to offer, and would imagine that you'll have to figure out how to get renv to work.

ARITRABANDOPADHYAY commented 10 months ago

ok i will try the method you suggested, and keep you updated.

kanishkan91 commented 10 months ago

Hello @ARITRABANDOPADHYAY. One thing that has worked for me is doing something like-

install.packages("renv", type="binary")

This tells R to get binary versions of the package and bypasses several errors (in my experience). Let me know if that works.

ARITRABANDOPADHYAY commented 10 months ago

hello @kanishkan91, i installed the "renv" using the code you gave, and then run the activate command and restore command, and received the following error. I am nor sure why it is not able to download a specific package, and how to resolve it, i have checked with different internet connections but no luck yet in finding a way around this. Error: failed to retrieve package 'cli' In addition: Warning messages: 1: curl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.com 2: download failed [error code 6] 3: internal error: unexpected status code 'structure(list(message = "download failed [error code 6]", call = NULL, traceback = c("Traceback (most recent calls last):", "24: renv::restore()", "23: records <- renv_restore_run_actions(project, diff, current, lockfile, rebuild) at restore.R#158", "22: records <- renv_retrieve(packages) at restore.R#185", "21: for (package in packages)", " handler(package, renv_retrieve_impl(package)) at retrieve.R#30", "20: for (package in packages)", " handler(package, renv_retrieve_impl(package)) at retrieve.R#30", "19: switch(source,", " bioconductor = renv_retrieve_bioconductor(record),", " bitbucket = renv_retrieve_bitbucket(record),", " git = renv_retrieve_git(record),", " github = renv_retrieve_github(record),", " gitlab = renv_retrieve_gitlab(record),", " repository = renv_retrieve_repos(record),", " url = renv_retrieve_url(record),", " [... truncated] 4: curl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.com 5: download failed [error code 6] 6: internal error: unexpected status code 'structure(list(message = "download failed [error code 6]", call = NULL, traceback = c("Traceback (most recent calls last):", "25: renv::restore()", "24: records <- renv_restore_run_actions(project, diff, current, lockfile, rebuild) at restore.R#158", "23: records <- renv_retrieve(packages) at restore.R#185", "22: for (package in packages)", " handler(package, renv_retrieve_impl(package)) at retrieve.R#30", "21: for (package in packages)", " handler(package, renv_retrieve_impl(package)) at retrieve.R#30", "20: switch(source,", " bioconductor = renv_retrieve_bioconductor(record),", " bitbucket = renv_retrieve_bitbucket(record),", " git = renv_retrieve_git(record),", " github = renv_retrieve_github(record),", " gitlab = renv_retrieve_gitlab(record),", " repository = renv_retrieve_repos(record),", " url = renv_retrieve_url(record),", " [... truncated] 7: curl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.com 8: download failed [error code 6] 9: internal error: unexpected status code 'structure(list(message = "download failed [error code 6]", call = NULL, traceback = c("Traceback (most recent calls last):", "25: renv::restore()", "24: records <- renv_restore_run_actions(project, diff, current, lockfile, rebuild) at restore.R#158", "23: records <- renv_retrieve(packages) at restore.R#185", "22: for (package in packages)", " handler(package, renv_retrieve_impl(package)) at retrieve.R#30", "21: for (package in packages)", " handler(package, renv_retrieve_impl(package)) at retrieve.R#30", "20: switch(source,", " bioconductor = renv_retrieve_bioconductor(record),", " bitbucket = renv_retrieve_bitbucket(record),", " git = renv_retrieve_git(record),", " github = renv_retrieve_github(record),", " gitlab = renv_retrieve_gitlab(record),", " repository = renv_retrieve_repos(record),", " url = renv_retrieve_url(record),", " [... truncated] 10: curl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.comcurl: (6) Could not resolve host: mran.microsoft.com

@kanishkan91 @crvernon @pkyle @bpbond can you please help if you have faced and resolved this kind of issue earlier,

ARITRABANDOPADHYAY commented 10 months ago

options(renv.config.mran.enabled = FALSE) this command resolver the repository issue, if anyone needs this, might check #1770 #1343