UD3-Lab / mintEMU

mintEMU - The Legacy of the European Postgraduate Master in Urbanism at TU Delft: A Text Mining Approach
Other
1 stars 0 forks source link

rrtools not working #43

Closed cforgaci closed 1 year ago

cforgaci commented 1 year ago

@alwil, I need some help with rrtools. For some reason, it seems that it is not installed and when I try to install it, this is what I get:

> devtools::install_github("benmarwick/rrtools")
Downloading GitHub repo benmarwick/rrtools@HEAD
── R CMD build ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/hk/0c_kwgjs1zlgczjlszxgq348281j_b/T/RtmpnkaykH/remotes7c1d631fe626/benmarwick-rrtools-cc80220/DESCRIPTION’ ...
─  preparing ‘rrtools’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted ‘LazyData’ from DESCRIPTION
─  building ‘rrtools_0.1.5.tar.gz’
   Warning: invalid uid value replaced by that for user 'nobody'
   Warning: invalid gid value replaced by that for user 'nobody'

Installing package into ‘/Users/claudiuforgaci/Library/Caches/org.R-project.R/R/renv/library/minTEMU-05a1c5b3/R-4.2/aarch64-apple-darwin20’
(as ‘lib’ is unspecified)
* installing *source* package ‘rrtools’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
✔ Setting active project to '/private/var/folders/hk/0c_kwgjs1zlgczjlszxgq348281j_b/T/RtmpAOVJwm/R.INSTALL8e8a7573d71/rrtools'
✔ Leaving 'LICENSE' unchanged
✔ Writing 'LICENSE.md'
✔ Adding '^LICENSE\\.md$' to '.Rbuildignore'

✔ Creating 'README.Rmd' from template.
✔ Adding 'README.Rmd' to `.Rbuildignore`.
• Modify 
✔ Adding code of conduct.
✔ Creating 'CONDUCT.md' from template.
✔ Adding 'CONDUCT.md' to `.Rbuildignore`.
✔ Adding instructions to contributors.
✔ Creating 'CONTRIBUTING.md' from template.
✔ Adding 'CONTRIBUTING.md' to `.Rbuildignore`.
✔ Adding .binder/Dockerfile for Binder
✔ Creating '.binder'
✔ Creating '.binder/Dockerfile' from template.
✔ Adding '.binder/Dockerfile' to `.Rbuildignore`.
• Modify 

✔ Adding 'here' pkg to Imports
✔ Creating 'analysis' directory and contents
✔ Creating 'analysis'
✔ Creating 'analysis/paper'
✔ Creating 'analysis/figures'
✔ Creating 'analysis/templates'
✔ Creating 'analysis/data'
✔ Creating 'analysis/data/raw_data'
✔ Creating 'analysis/data/derived_data'
✔ Creating 'analysis/supplementary-materials'
✔ Creating 'references.bib' from template.
✔ Creating 'paper.qmd' from template.

Next, you need to:  ↓ ↓ ↓ ↓ 
• Write your article/report/thesis, start at the paper.qmd file
• Add the citation style library file (csl) to replace the default provided here, see https://github.com/citation-style-language/
• Add bibliographic details of cited items to the 'references.bib' file
• For adding captions & cross-referencing in an qmd, see https://quarto.org/docs/authoring/cross-references.html
• For adding citations & reference lists in an qmd, see https://quarto.org/docs/authoring/footnotes-and-citations.html

Note that:
⚠ Your data files are tracked by Git and will be pushed to GitHub 

This project was set up by rrtools.

You can start working now or apply some more basic configuration.
Check out https://github.com/benmarwick/rrtools for an explanation of all the project configuration functions of rrtools.
Warning message:
In file.remove(".Rprofile") :
  cannot remove file '.Rprofile', reason 'No such file or directory'
** help
*** installing help indices
** building package indices
✔ Setting active project to '/private/var/folders/hk/0c_kwgjs1zlgczjlszxgq348281j_b/T/RtmpAOVJwm/R.INSTALL8e8a7573d71/rrtools'
✔ Leaving 'LICENSE' unchanged

Error: `README.Rmd` already exists.
Execution halted
ERROR: installing package indices failed
* removing ‘/Users/claudiuforgaci/Library/Caches/org.R-project.R/R/renv/library/minTEMU-05a1c5b3/R-4.2/aarch64-apple-darwin20/rrtools’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/hk/0c_kwgjs1zlgczjlszxgq348281j_b/T//RtmpnkaykH/file7c1d433efba1/rrtools_0.1.5.tar.gz’ had non-zero exit status

This is my session info:

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
 [1] shiny_1.7.4        minTEMU_0.0.0.9000 tidygeocoder_1.0.5 tm_0.7-10          NLP_0.2-1          SnowballC_0.7.0    tidytext_0.4.1     forcats_0.5.2      stringr_1.5.0     
[10] dplyr_1.0.10       purrr_1.0.1        readr_2.1.3        tidyr_1.2.1        tibble_3.1.8       ggplot2_3.4.0      tidyverse_1.3.2    here_1.0.1        

loaded via a namespace (and not attached):
  [1] googledrive_2.0.0   colorspace_2.0-3    ellipsis_0.3.2      rprojroot_2.0.3     fs_1.6.0            rstudioapi_0.14     farver_2.1.1        remotes_2.4.2       bit64_4.0.5        
 [10] fansi_1.0.4         lubridate_1.9.0     xml2_1.3.3          R.methodsS3_1.8.2   cachem_1.0.6        knitr_1.42          pkgload_1.3.2       jsonlite_1.8.4      broom_1.0.2        
 [19] dbplyr_2.3.0        R.oo_1.25.0         png_0.1-8           clipr_0.8.0         compiler_4.2.2      httr_1.4.4          backports_1.4.1     assertthat_0.2.1    Matrix_1.5-1       
 [28] fastmap_1.1.0       gargle_1.2.1        cli_3.6.0           later_1.3.0         htmltools_0.5.4     prettyunits_1.1.1   tools_4.2.2         gtable_0.3.1        glue_1.6.2         
 [37] maps_3.4.1          Rcpp_1.0.10         slam_0.1-50         styler_1.9.0        jquerylib_0.1.4     cellranger_1.1.0    vctrs_0.5.2         xfun_0.36           ps_1.7.2           
 [46] brio_1.1.3          testthat_3.1.6      rvest_1.0.3         timechange_0.2.0    mime_0.12           miniUI_0.1.1.1      lifecycle_1.0.3     renv_0.16.0         devtools_2.4.5     
 [55] googlesheets4_1.0.1 scales_1.2.1        vroom_1.6.1         hms_1.1.2           promises_1.2.0.1    parallel_4.2.2      yaml_2.3.7          curl_5.0.0          memoise_2.0.1      
 [64] reticulate_1.28     sass_0.4.5          stringi_1.7.12      tokenizers_0.3.0    desc_1.4.2          pkgbuild_1.4.0      rlang_1.0.6         pkgconfig_2.0.3     evaluate_0.20      
 [73] lattice_0.20-45     htmlwidgets_1.6.1   labeling_0.4.2      bit_4.0.5           processx_3.8.0      tidyselect_1.2.0    magrittr_2.0.3      R6_2.5.1            generics_0.1.3     
 [82] profvis_0.3.7       DBI_1.1.3           pillar_1.8.1        haven_2.5.1         withr_2.5.0         janeaustenr_1.0.0   modelr_0.1.10       crayon_1.5.2        utf8_1.2.2         
 [91] rmarkdown_2.20      tzdb_0.3.0          urlchecker_1.0.1    usethis_2.1.6       grid_4.2.2          readxl_1.4.1        callr_3.7.3         git2r_0.31.0        reprex_2.0.2       
[100] digest_0.6.31       R.cache_0.16.0      xtable_1.8-4        httpuv_1.6.8        R.utils_2.12.2      munsell_0.5.0       bslib_0.4.2         sessioninfo_1.2.2  

Any ideas on how I can solve this issue?

alwil commented 1 year ago

Some questions:

I am not sure, but looking at the error, creating the test repository is failing, as some of the files created by the repository already exist.

It looks to me as if the installation was taking place within the renv (for a specific branch? ). Have you checked if there is a README.Rmd files in any of the mentioned directories?

The error comes from call of this function :

 path <- file.path(pkg$path, out_path, save_as)
  if (!can_overwrite(path, ask = ask)) {
    stop("`", save_as, "` already exists.", call. = FALSE)
  }

It would suggest that there is a README.Rmd that cannot be overwritten?

cforgaci commented 1 year ago

Some questions:

  • Are you trying to install this within renv?

Yes, renv is active.

  • Are you working on a specific branch?

I tried both on main and on another branch.

  • Are you in a project?

I am in the mintEMU project

I am assuming it is referring to the README.Rmd that rrtools uses to generate the README.md in the project root. Should I try to remove it?

alwil commented 1 year ago

I am assuming it is referring to the README.Rmd that rrtools uses to generate the README.md in the project root. Should I try to remove it?

Looking at the source code, it might be that it might run into similar issues with other automatically created files. I wonder if rrtools is something needed to recreate the analysis or use the package? I think only suplementary_materials/create_rrtools.R would need it?

cforgaci commented 1 year ago

I can run the analysis but I cannot knit, which is not ok. I will try removing files that throw this error and see if I can manage to knit somehow. I will report back once I tried.

alwil commented 1 year ago

Hi @cforgaci ,

I looked at the paper.qmd, and it failed for me too. It seems that the issue comes from the install.packages() in this statement:

packages <- c(
  "here",                                        # Managing paths
  "tidyverse",                                   # Data manipulation and visualisation
  "tidytext", "SnowballC", "tm", "topicmodels",  # Text processing and analysis
  "tidygeocoder",                                # Working with spatial data
  "igraph", "ggraph"                             # Network analysis and visualsation
)

## Load required packages, install them if needed
for (package in packages) {
  if (!require(package, character.only = TRUE)) {
    install.packages(package)
  }
  library(package, character.only = TRUE)
}

As explained in this discussion, Knitr sets up an R session without a CRAN mirror set. So this needs to be explicitly stated or defined in the .Rprofile. Addapting the install.packages() call: install.packages(package, "http://cran.us.r-project.org") did the trick for me. However, I've had a few other issues with knitting:

I'm working on a pull request to clean the file. I will also push the updated renv.lock file, and lets see if you can restore it from your side?