o2r-project / containerit

Package an R workspace and all dependencies as a Docker container
https://o2r.info/containerit/
GNU General Public License v3.0
290 stars 29 forks source link

Extend library pre-check to all `.R` script files #124

Open Timmimim opened 6 years ago

Timmimim commented 6 years ago

Some .Rmd files for papers do not include code themselves, but link to script files via the source("./script.R") function.

In these script files, there likely will be libraries required, as for example in the workspace for the Technical note Estimating unbiased transfer-function paper (https://uni-muenster.sciebo.de/apps/files/?dir=/o2r-data/Korpus/Reproducing%20papers/Finished/Technical%20note%20Estimating%20unbiased%20transfer-function&fileid=638141477).

The pre-check for required libraries currently only covers the main.Rmd file, installing any and all required libraries loaded, e.g. via library("package_name"). Any library loaded in a script file, however, is not found, and thus not installed.

This may lead to execution failure, as requested packages may not be standard features of the rocker/geospatial container environment.

Quitting from lines 19-22 (main.Rmd) Error in library(fields) : there is no package called 'fields' Calls: <Anonymous> ... eval -> source -> withVisible -> eval -> eval -> library
Execution halted
Error in obtain_localSessionInfo(rmd_file = file, vanilla = vanilla, slave = silent, : Failed to execute the script locally! A sessionInfo could not be determined. Calls: write ... dockerfile -> dockerfileFromFile -> obtain_localSessionInfo Execution halted

The Pre-Check SHOULD cover all .Rmd AND .R files, or at least the files that are loaded and used in main.Rmd

Note for example paper: After fixing this issue, the paper will still not work, because the default mirror of containerit installs a package that cannot be loaded (spam). The workspace contains a commented-out fix for the issue, which is a install.packages() function call with a specified CRAN mirror.

nuest commented 5 years ago

I think this is out of scope for the foreseeable future. Pre-checks can only go so far.