[R-pkg-devel] Testing package on R-devel in a docker container
Thanks, everyone, for responding. Here a summary of my research so far--I do not quite understand what I am doing, but I spotted a number of different issues, and I got the checks to work. * I was not aware of the distinction between default and recommended packages, and the fact that the latter is not installed by default (although usually they are on production systems). * in the rocker/r-devel container, R and R-devel use (partly) overlapping lib paths: `/usr/local/lib/R/site-library` and `/usr/lib/R/library`. * R and R-devel have different packages installed by default, but because both access `/usr/lib/R/library`, both seem to have access to both default and recommended packages. * `RD CMD check` uses a different lib path, containing `/usr/local/lib/R/library` and a temporary folder. The latter will contain the needed packages given they are installed in a certain location (I still do not understand how they get there, and from where). * The message I got -- package _lattice_ not available -- was due to two reasons: a) it is a recommended, not a default package; and b) it is installed in `/usr/lib/R/library` where it is normally accessible for both R and R-devel, and hence was not installed again. However, from there it is not copied to the temporary folder that R CMD check uses. * Finally, by setting `ENV R_LIBS=/usr/local/lib/R/site-library/` in the Dockerfile, the checks work. But I am not sure why. It would be great to isolate R and R-devel better in the docker image. Not sure whether it is easy to do... Cheers, Ott On Tue, Aug 12, 2025 at 1:17?AM Berwin A Turlach <berwin.turlach at gmail.com> wrote:
On Mon, 11 Aug 2025 08:47:45 -0400 Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
Regarding Dirk's "narrower" comment: I think that is really his decision about the docker container, not a property of R CMD check. R CMD check needs to be able to succeed if the only packages installed are the hard dependencies (Depends, Imports, plus base packages), but it doesn't actually install anything. That's up to you before running it.
Obviously I cannot speak for Dirk and where his comment comes from :),
but WRE has since ages the following note:
Note: R CMD check and R CMD build run R processes with
--vanilla in which none of the user?s startup files are read.
If you need R_LIBS set (to find packages in a non-standard
library) you can set it in the environment: also you can use
the check and build environment files (as specified by the
environment variables R_CHECK_ENVIRON and R_BUILD_ENVIRON; if
unset, files55 ~/.R/check.Renviron and ~/.R/build.Renviron are
used) to set environment variables when using these utilities.
On my linux box I update and compile R patched and R devel regularly,
and at some point I got tired of also installing a lot of packages
(that I need for checking) each time. So I moved all of these
additional packages to another library (where they are updated on an
as needed basis via update.packages(ask=FALSE, CheckBuilt=TRUE)). After
this restructure R patched and R devel could promptly not find those
packages anymore (until I changed my scripts to create appropriate
symbolic links, I did not want to go down the path of setting
environment variables).
Cheers,
Berwin