Skip to content
Prev 6514 / 12125 Next

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

Hi,

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)
...
Comment: There's also a 'singularity {run,exec,eval} ...' similar to
'docker' which comes with more features but lots can be done without
it.


# 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)
...
[1] "/tmp/R-libs-test"
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?,
?manipulateWidget?
...

** 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
?/tmp/hb/RtmpzBZ0FJ/downloaded_packages?
Warning message:
In install.packages("rgl") :
  installation of package ?rgl? had non-zero exit status
chr [1:77] "base64enc" "BH" "bslib" "cachem" "callr" ...
# 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
...
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.

/Henrik
On Thu, Jan 28, 2021 at 2:29 PM Dirk Eddelbuettel <edd at debian.org> wrote: