Changes between Version 2 and Version 3 of cypress/InstallingRPackages

03/07/22 16:46:56 (2 years ago)

Added section Capturing Logging Output From R Package Installation


  • cypress/InstallingRPackages

    v2 v3  
    44If you want to use some R packages that are not yet installed in your desired version of R on Cypress,
    55then you have several alternatives, as prescribed below, for locations for installing those packages. Those locations include either your user home directory or lustre sub-directory, and the methods will vary depending on your desired level of reproducibility.
     7For capturing logging output including error messages during installation, see [#CapturingRlogging below].
    79For more information on how the R startup process works, see
     140== [=#CapturingRlogging Capturing Logging Output From R Package Installation] ==
     142When you install an R package, the logging output can include multiple screens of information before finally ending with a simple, brief indication of success or failure such as {{{installation of package 'RSQLite' had non-zero exit status}}}.
     144As a result, any helpful diagnostic information can be easily lost - including one or more critical error messages that you may not notice as they scroll quickly and entirely out of view and out of your terminal window buffer.
     146To avoid this loss of diagnostic information, the R function **install.packages()** provides an option **keep_outputs=T** (or **keep_outputs=TRUE**).
     148You can use the **keep_outputs=T** option for capturing the logging output in files - one file per attempted R package - for your later inspection to look for possible error messages - as in the following.
     151> install.packages("RSQLite", keep_outputs=T)  # captures log output in a file RSQLite.out
     154Then from the BASH command line you can search for occurrences of the string {{{error:}}} either via **less** or **grep** BASH commands. (See [ Linux Commands].)
     156For example in the following, multiple error messages captured in the file **RSQLite.out** indicate that the collection of boost C++ libraries is unexpectedly missing, which can be provided by loading the appropriate module, **boost/1.76.0**,  on Cypress. (See [ Module Command].)
     159[tulaneid@cypress2 ~]$ grep -i error: RSQLite.out
     160vendor/boost/preprocessor/list/fold_left.hpp(341): catastrophic error: cannot open source file "boost/preprocessor/list/detail/edg/fold_left.hpp"
     162vendor/boost/preprocessor/list/fold_left.hpp(341): catastrophic error: cannot open source file "boost/preprocessor/list/detail/edg/fold_left.hpp"
     163ERROR: compilation failed for package ‘RSQLite’
     166The following excerpt is taken from the output in the R session of {{{> help("install.packages")}}}
     169keep_outputs: a logical: if true, keep the outputs from installing
     170          source packages in the current working directory, with the
     171          names of the output files the package names with ‘.out’
     172          appended.  Alternatively, a character string giving the
     173          directory in which to save the outputs.  Ignored when
     174          installing from local files.