[R-pkg-devel] Testing on old R versions

Henrik Bengtsson henr|k@bengt@@on @end|ng |rom gm@||@com
Fri Jan 29 01:27:11 CET 2021


you're probably already aware of it, but 'rgl' depends on 'magrittr'
which depends on 'rlang', and the latter requires R (>= 3.3.0).

BTW, I find Singularity (https://github.com/hpcng/singularity/) more
convenient to work with than Docker, e.g. you run as host $USER also
"inside" the container, $PWD and your $HOME folder is automatically
mounted, the built container is a single executable (just like any
other software you run).   Here's how you can use Rocker's r-base with
Singularity on Linux (Ubuntu 18.04):

# Download and build

{host}$ cd /tmp
{host}$ singularity build r-3.3.0.sif docker://r-base:3.3.0

{host}$ ls -l r-3.3.0.sif
-rwxr-xr-x 1 hb hb 385630208 Jan 28 16:05 r-3.3.0.sif

# Run as-is

{host}$ ./r-3.3.0.sif

R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

> quit("no")

Comment: There's also a 'singularity {run,exec,eval} ...' similar to
'docker' which comes with more features but lots can be done without

# Persistent package installs to host via custom R_LIBS_USER

{host}$ cd /tmp
{host}$ mkdir R-libs-3.3.0
{host}$ R_LIBS_USER=R-libs-3.3.0 ./r-3.3.0.sif

R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

> .libPaths()[1]
[1] "/tmp/R-libs-test"
> install.packages("rgl")
Installing package into ‘/tmp/R-libs-test’
(as ‘lib’ is unspecified)
also installing the dependencies ‘ps’, ‘fs’, ‘rappdirs’, ‘processx’,
‘Rcpp’, ‘BH’, ‘sass’, ‘jquerylib’, ‘callr’, ‘yaml’, ‘digest’,
‘base64enc’, ‘rlang’, ‘evaluate’, ‘highr’, ‘markdown’, ‘xfun’,
‘httpuv’, ‘mime’, ‘xtable’, ‘R6’, ‘sourcetools’, ‘later’, ‘promises’,
‘crayon’, ‘fastmap’, ‘withr’, ‘commonmark’, ‘glue’, ‘bslib’, ‘cachem’,
‘ellipsis’, ‘lifecycle’, ‘lazyeval’, ‘miniUI’, ‘webshot’,
‘htmlwidgets’, ‘htmltools’, ‘knitr’, ‘jsonlite’, ‘shiny’, ‘crosstalk’,

** preparing package for lazy loading
Error : object ‘hcl.colors’ is not exported by 'namespace:grDevices'
ERROR: lazy loading failed for package ‘rgl’
* removing ‘/tmp/R-libs-3.3.0/rgl’

The downloaded source packages are in
Warning message:
In install.packages("rgl") :
  installation of package ‘rgl’ had non-zero exit status

> str(rownames(installed.packages()))
 chr [1:77] "base64enc" "BH" "bslib" "cachem" "callr" ...

> quit("no")

# The packages are indeed installed to the host folder and survives restarts

{host}$ R_LIBS_USER=R-libs-3.3.0 ./r-3.3.0.sif
> str(rownames(installed.packages()))
 Named chr [1:77] "base64enc" "BH" "bslib" "cachem" "callr" ...
 - attr(*, "names")= chr [1:77] "" "" "" "" ...

So, running R via Singularity is almost the same as running R directly
on the host.


On Thu, Jan 28, 2021 at 2:29 PM Dirk Eddelbuettel <edd using debian.org> wrote:
> On 28 January 2021 at 16:50, Duncan Murdoch wrote:
> | Thanks Dirk, Neal and Nathan.  I ended up going with Dirk's suggestion.
> |
> | So far I haven't got it to work in 3.2.0; I probably won't put much
> | effort into supporting that old version.  But it's fine in 3.4.0 and
> | 3.5.0, and I'm trying 3.3.0 now.  Rocker rocks!
> Thanks, I would have to agree here :)
> | P.S. rgl now installs in the basic r-base container, without adding
> | additional libs.  This is due to some config checks that let it run on a
> | barebones machine:  it can still produce WebGL output for a browser, it
> | just can't show it on screen.
> Most excellent, didn't know that part.  Ping we off-list if you're interested
> in automating this, I also use these containers (or sometimes extensions with
> additional build-dependencies) to test builds in CI settings. Setting that
> can be pretty straightforward and self-contained.  It's easiest to instrument
> when you don't even need other build dependencies.
> Dirk
> --
> https://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

More information about the R-package-devel mailing list