Dubukay
Dubukay

Reputation: 2071

R CMD check cannot find packages during package build with _R_CHECK_DEPENDS_ONLY_ set to true

I recently resubmitted a package to CRAN that got kicked back to me because packages listed in my Suggests field can't be found when running tests and rebuilding vignettes. Uwe pointed out that this occurs when the environment variable _R_CHECK_DEPENDS_ONLY_ is set to "true" and I can confirm that I'm getting the error on my local machine when this is the case. The errors don't show up if I set this to "false" or remove it from the environmental variable list.

Without suggested packages available the checks fail, see below. Note
that suggested packages should only be used conditionally on their
availability. You can reproduce by setting the env var
_R_CHECK_DEPENDS_ONLY_=true

In my DESCRIPTION file (no Depends):

Imports: 
    xml2, 
    base64enc,
    data.table,
    utils,
    stats
RoxygenNote: 7.3.1
Suggests: 
    testthat,
    knitr,
    rmarkdown,
    tidyverse

The errors:

> library(testthat)
> test_check("RaMS")
Loading required package: RaMS
Error in `FUN()`:
! In path: "C:\\Users\\willi\\AppData\\Local\\Temp\\Rtmpa84W6Z\\file43e87394ab3\\RaMS.Rcheck\\tests\\testthat\\setup-load.R"
Caused by error in `library()`:
! there is no package called 'tidyverse'
> checking re-building of vignette outputs ... ERROR
  Error(s) in re-building vignettes:
  --- re-building 'Intro-to-RaMS.Rmd' using rmarkdown
  Error: processing vignette 'Intro-to-RaMS.Rmd' failed with diagnostics:
  there is no package called 'rmarkdown'

This isn't particularly surprising behavior because the docs indicate that _R_CHECK_DEPENDS_ONLY_ means that it uses only Depends/Imports to check the package. However, I'm surprised that the package is being tested / has vignettes built under these conditions because that's exactly what the Suggests field is for and I've never run into a build failing due to this before. It seems like it may have something to do with the change in 4.2.0 where _R_CHECK_DEPENDS_ONLY_ can be applied selectively to examples, tests and/or vignettes in R CMD check. The default still seems to be "false" so I'm not sure why my package is being checked under the "true" setting.

Is there a way to tell CRAN that my tests and vignettes won't run without the packages in the Suggests field? What else can I do to get rid of this error?

Upvotes: 0

Views: 57

Answers (0)

Related Questions