inbo/tutorials

On starting RStudio in Win 10 using R 4.2, checklist won't install if its dependencies are missing (+ causing more trouble)

Closed this issue · 4 comments

@ThierryO there are some problems with Rprofile.site (at 29bf515) in Windows, when checklist and a bunch of dependencies are still missing:

  1. The checklist installation is done before setting a CRAN mirror. This triggers RStudio to show a dialogue to select one, which isn't ideal.
  2. Next, checklist installation fails:
Installing package intoC:/R/library’
(aslibis unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning message:
packagechecklistis not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

It can be remedied manually, while still in the same session:

> "checklist" %in% rownames(utils::installed.packages())
[1] FALSE
> getOption("repos")
                                       CRAN 
             "https://cloud.r-project.org/" 
                                       INLA 
"https://inla.r-inla-download.org/R/stable" 
                                       inbo 
              "https://inbo.r-universe.dev" 
> utils::install.packages("checklist")
Installing package intoC:/R/library’
(aslibis unspecified)
also installing the dependencieshttpcode’, ‘triebeard’, ‘lazyeval’, ‘systemfonts’, ‘textshaping’, ‘crul’, ‘pingr’, ‘urltools’, ‘codemeta’, ‘rex’, ‘cyclocomp’, ‘xmlparsedata’, ‘backports’, ‘downlit’, ‘ragg’, ‘fauxpas’, ‘data.table’, ‘codemetar’, ‘lintr’, ‘pkgdown’, ‘rorcidtrying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/httpcode_0.3.0.zip'
Content type 'application/zip' length 35049 bytes (34 KB)
downloaded 34 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/triebeard_0.3.0.zip'
Content type 'application/zip' length 488464 bytes (477 KB)
downloaded 477 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/lazyeval_0.2.2.zip'
Content type 'application/zip' length 160756 bytes (156 KB)
downloaded 156 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/systemfonts_1.0.4.zip'
Content type 'application/zip' length 1042662 bytes (1018 KB)
downloaded 1018 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/textshaping_0.3.6.zip'
Content type 'application/zip' length 1021405 bytes (997 KB)
downloaded 997 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/crul_1.2.0.zip'
Content type 'application/zip' length 650041 bytes (634 KB)
downloaded 634 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/pingr_2.0.1.zip'
Content type 'application/zip' length 59149 bytes (57 KB)
downloaded 57 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/urltools_1.7.3.zip'
Content type 'application/zip' length 621738 bytes (607 KB)
downloaded 607 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/codemeta_0.1.1.zip'
Content type 'application/zip' length 168235 bytes (164 KB)
downloaded 164 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/rex_1.2.1.zip'
Content type 'application/zip' length 125877 bytes (122 KB)
downloaded 122 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/cyclocomp_1.1.0.zip'
Content type 'application/zip' length 33311 bytes (32 KB)
downloaded 32 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/xmlparsedata_1.0.5.zip'
Content type 'application/zip' length 21586 bytes (21 KB)
downloaded 21 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/backports_1.4.1.zip'
Content type 'application/zip' length 102215 bytes (99 KB)
downloaded 99 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/downlit_0.4.0.zip'
Content type 'application/zip' length 109257 bytes (106 KB)
downloaded 106 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/ragg_1.2.2.zip'
Content type 'application/zip' length 1297889 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/fauxpas_0.5.0.zip'
Content type 'application/zip' length 2756204 bytes (2.6 MB)
downloaded 2.6 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/data.table_1.14.2.zip'
Content type 'application/zip' length 2240371 bytes (2.1 MB)
downloaded 2.1 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/codemetar_0.3.4.zip'
Content type 'application/zip' length 619071 bytes (604 KB)
downloaded 604 KB

trying URL 'https://inbo.r-universe.dev/bin/windows/contrib/4.2/lintr_2.0.1.9000.zip'
Content type 'application/zip' length 655371 bytes (640 KB)
downloaded 640 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/pkgdown_2.0.3.zip'
Content type 'application/zip' length 791254 bytes (772 KB)
downloaded 772 KB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.2/rorcid_0.7.0.zip'
Content type 'application/zip' length 1317893 bytes (1.3 MB)
downloaded 1.3 MB

trying URL 'https://inbo.r-universe.dev/bin/windows/contrib/4.2/checklist_0.2.4.zip'
Content type 'application/zip' length 617363 bytes (602 KB)
downloaded 602 KB

packagehttpcodesuccessfully unpacked and MD5 sums checked
packagetriebeardsuccessfully unpacked and MD5 sums checked
packagelazyevalsuccessfully unpacked and MD5 sums checked
packagesystemfontssuccessfully unpacked and MD5 sums checked
packagetextshapingsuccessfully unpacked and MD5 sums checked
packagecrulsuccessfully unpacked and MD5 sums checked
packagepingrsuccessfully unpacked and MD5 sums checked
packageurltoolssuccessfully unpacked and MD5 sums checked
packagecodemetasuccessfully unpacked and MD5 sums checked
packagerexsuccessfully unpacked and MD5 sums checked
packagecyclocompsuccessfully unpacked and MD5 sums checked
packagexmlparsedatasuccessfully unpacked and MD5 sums checked
packagebackportssuccessfully unpacked and MD5 sums checked
packagedownlitsuccessfully unpacked and MD5 sums checked
packageraggsuccessfully unpacked and MD5 sums checked
packagefauxpassuccessfully unpacked and MD5 sums checked
packagedata.tablesuccessfully unpacked and MD5 sums checked
packagecodemetarsuccessfully unpacked and MD5 sums checked
packagelintrsuccessfully unpacked and MD5 sums checked
packagepkgdownsuccessfully unpacked and MD5 sums checked
packagerorcidsuccessfully unpacked and MD5 sums checked
packagechecklistsuccessfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\floris_vanderhaeghe\AppData\Local\Temp\RtmpMtaUUX\downloaded_packages
> sessioninfo::session_info()
- Session info -------------------------------------------------------------------
 setting  value
 version  R version 4.2.0 (2022-04-22 ucrt)
 os       Windows 10 x64 (build 19043)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  Dutch_Belgium.1252
 ctype    Dutch_Belgium.1252
 tz       Europe/Paris
 date     2022-05-17
 rstudio  2022.02.2+485 Prairie Trillium (desktop)
 pandoc   NA

- Packages -----------------------------------------------------------------------
 package     * version date (UTC) lib source
 cli           3.3.0   2022-04-25 [1] CRAN (R 4.2.0)
 fortunes      1.5-4   2016-12-29 [1] CRAN (R 4.2.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.2.0)

 [1] C:/R/library
 [2] C:/R/R-4.2.0/library

----------------------------------------------------------------------------------

Some other observations:

  • Moving the line:

if (!"checklist" %in% rownames(utils::installed.packages())) {
utils::install.packages("checklist")
}

below the options() statement makes RStudio not able to start.

  • Everything does work (including the problem further down with remotes::install_github) if checklist is the only missing package (i.e. when the above dependencies have been installed).
  • Everything does work (including the problem further down with remotes::install_github) if the above three lines are commented out.
  • When not resolved, remotes::install_github() doesn't seem to get a package installed (mentioned by @DriesAdriaens for "inbo/n2khab@59a16bc"), and reproduced below on my machine:
R version 4.2.0 (2022-04-22 ucrt) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Installing package intoC:/R/library’
(aslibis unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning message:
packagechecklistis not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages 

If you want to do an integer divide, you should only use integers to divide
with.
   -- Thierry Onkelinx ((not entirely correctly) in an answer to "understanding
      integer divide (%/%)")
      R-help (January 2007)

> remotes::install_github("inbo/n2khab@59a16bc")
Downloading GitHub repo inbo/n2khab@59a16bc
WARNING: Rtools is required to build R packages, but no version of Rtools compatible with R 4.2.0 was found. (Only the following incompatible version(s) of Rtools were found: 4.0)

Please download and install Rtools 4.2 from https://cran.r-project.org/bin/windows/Rtools/ or https://www.r-project.org/nosvn/winutf8/ucrt3/.
v  checking for file 'C:\Users\floris_vanderhaeghe\AppData\Local\Temp\RtmpywX0QD\remotes321046343212\inbo-n2khab-59a16bc/DESCRIPTION' ... 
-  preparing 'n2khab':
v  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
   Removed empty directory 'n2khab/pkgdown'
   Omitted 'LazyData' from DESCRIPTION
-  building 'n2khab_0.6.0.900.tar.gz'
   
Installing package intoC:/R/library’
(aslibis unspecified)
Installing package into 'C:/R/library'
(as 'lib' is unspecified)
Error in contrib.url(repos, "source") : 
  trying to use CRAN without setting a mirror
Calls: <Anonymous> -> contrib.url
Execution halted
Warning message:
In i.p(...) :
  installation of packageC:/Users/FLORIS~1/AppData/Local/Temp/RtmpywX0QD/file32102e8d555c/n2khab_0.6.0.900.tar.gzhad non-zero exit status

fixed in #312

I've tried that too, but it generates the above described won't-start behaviour of RStudio as long as checklist dependencies aren't installed first. In my case. Weird. Will try once again with your update after restarting Windows.

Note that RStudio needs time to install the package and it dependencies in the background.

Note that RStudio needs time to install the package and it dependencies in the background.

Yes, but not forever. It seems, in practice, that idle instances of RStudio are present as a background process, doing nothing. See conclusion at the end.

Problem confirmed using #312 (Rprofile.site at 31a7ef0):

  • RStudio doesn't start with this Rprofile.site if dependencies ‘httpcode’, ‘triebeard’, ‘lazyeval’, ‘systemfonts’, ‘textshaping’, ‘crul’, ‘pingr’, ‘urltools’, ‘codemeta’, ‘rex’, ‘cyclocomp’, ‘xmlparsedata’, ‘backports’, ‘downlit’, ‘ragg’, ‘fauxpas’, ‘data.table’, ‘codemetar’, ‘lintr’, ‘pkgdown’, ‘rorcid’ are missing.
  • Manual remedy:
    • comment out the if() statement for checklist (Rprofile.site)
    • start RStudio.
    • install.packages("checklist"). Gives no problem, the above deps are installed and then checklist.
    • close RStudio, restore the if() statement in Rprofile.site and restart RStudio. This shows no problems anymore.

Now, a further experiment with the repaired state:

  • remove.packages("checklist")
  • close & restart RStudio. Only now checklist is auto-installed:
R version 4.2.0 (2022-04-22 ucrt) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


Oops. Was that what I was expecting?
   -- Louise Matthews (during the practicals of 'Statistical Practice in
      Epidemiology Using R')
      SPE Course, Tartu (May 2005)

> "checklist" %in% rownames(utils::installed.packages())
[1] TRUE
> 

The above steps can be reproduced after removing all above-referred dependencies.

Update: the problem lies with RStudio itself. With Rgui.exe, it works. Hence, will close this issue again since it shouldn't happen with current Rprofile.site. Thanks for the update.

RStudio 2022.02.2+485 "Prairie Trillium" Release (8acbd38b0d4ca3c86c570cf4112a8180c48cc6fb, 2022-04-19) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36