r-lib / rcmdcheck

Run R CMD check from R and collect the results
https://rcmdcheck.r-lib.org
Other
115 stars 27 forks source link

`devtools::check()` does not inform about unavailable suggested packages #143

Closed matthiasgomolka closed 3 years ago

matthiasgomolka commented 3 years ago

I noticed that devtools::check() does not show all the information which is shown by Rcmd.exe. When not all suggested packages are installed, devtools::check() fails, but the error message is not helpful:

-  checking package dependencies ...Warning: unable to access index for repository https://CRAN.R-project.org/src/contrib:
     cannot open URL 'https://CRAN.R-project.org/src/contrib/PACKAGES'
   Warning: unable to access index for repository https://bioconductor.org/packages/3.11/bioc/src/contrib:
     cannot open URL 'https://bioconductor.org/packages/3.11/bioc/src/contrib/PACKAGES'
   Warning: unable to access index for repository https://bioconductor.org/packages/3.11/data/annotation/src/contrib:
     cannot open URL 'https://bioconductor.org/packages/3.11/data/annotation/src/contrib/PACKAGES'
   Warning: unable to access index for repository https://bioconductor.org/packages/3.11/data/experiment/src/contrib:
     cannot open URL 'https://bioconductor.org/packages/3.11/data/experiment/src/contrib/PACKAGES'
   Warning in url(sprintf("%s/%s", cran, path), open = "rb") :
     InternetOpenUrl failed: 'Die Serververbindung konnte nicht hergestellt werden.'
   Error in url(sprintf("%s/%s", cran, path), open = "rb") : 
     cannot open the connection
   Execution halted

Important: I have no internet connection from within R.

When I check the identical package with Rcmd.exe directly, I get the following output and I understand the problem:

* checking package dependencies ... ERROR
Packages suggested but not available:
  'fst', 'here', 'openxlsx', 'renv', 'visNetwork'

The suggested packages are required for a complete check.
Checking can be attempted without them by setting the environment
variable _R_CHECK_FORCE_SUGGESTS_ to a false value.

After installing the mentioned packages, devtools::check() runs without errors.

hadley commented 3 years ago

This is not a testthat issue, and I find the report hard to believe because I know I see this message all the time:

* checking package dependencies ... ERROR
Packages suggested but not available:
  'fst', 'here', 'openxlsx', 'renv', 'visNetwork'
matthiasgomolka commented 3 years ago

Sorry for posting this in the wrong repo! No idea how I mixed that up.

Regarding the problem itself: Why would I make that up? But I guess, it's likely due to the fact that I don't have an internet connection from R itself.

gaborcsardi commented 3 years ago

@matthiasgomolka Are you on Windows? It is possibly because of output buffering, which we could fix in rcmdcheck. I'll move this issue over there.

matthiasgomolka commented 3 years ago

@gaborcsardi Thanks for moving the issue to the correct repo! Sorry again for placing it in the wrong one.

Yes, I'm on Windows. Here's my sessionInfo():

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.1252    

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

loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2   

Is there anything else you need?

hadley commented 3 years ago

@matthiasgomolka I'm not saying you're making it up — I'm saying that something else is clearly going on, so you'll need to provide a full reprex.

matthiasgomolka commented 3 years ago

@matthiasgomolka I'm not saying you're making it up — I'm saying that something else is clearly going on, so you'll need to provide a full reprex.

I did not mean to be rude. Maybe my English is not that good that I always comprehend such nuances. I'll provide a reprex.

gaborcsardi commented 3 years ago

Don't try too hard to create a reprex. This is probably not deterministic, and I think I know how to fix it.

gaborcsardi commented 3 years ago

Actually this happens because devtools::check() runs R CMD check with --as-cran by default. With --as-cran, R CMD check does not even get to the suggested packages, but fails with the same InternetOpenUrl error as in your initial post.

If you don't want to run the check with --as-cran, use devtools::check(cran = FALSE).