Changes between Version 2 and Version 3 of cypress/InstallingRPackages


Ignore:
Timestamp:
03/07/22 16:46:56 (2 years ago)
Author:
cbaribault
Comment:

Added section Capturing Logging Output From R Package Installation

Legend:

Unmodified
Added
Removed
Modified
  • 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.
     6
     7For capturing logging output including error messages during installation, see [#CapturingRlogging below].
    68
    79For more information on how the R startup process works, see https://cran.r-project.org/web/packages/startup/vignettes/startup-intro.html
     
    135137}}}
    136138
     139
     140== [=#CapturingRlogging Capturing Logging Output From R Package Installation] ==
     141
     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}}}.
     143
     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.
     145
     146To avoid this loss of diagnostic information, the R function **install.packages()** provides an option **keep_outputs=T** (or **keep_outputs=TRUE**).
     147
     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.
     149
     150{{{
     151> install.packages("RSQLite", keep_outputs=T)  # captures log output in a file RSQLite.out
     152}}}
     153
     154Then from the BASH command line you can search for occurrences of the string {{{error:}}} either via **less** or **grep** BASH commands. (See [https://wiki.hpc.tulane.edu/trac/wiki/cypress/BasicLinuxComands#LinuxCommands Linux Commands].)
     155
     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 [https://wiki.hpc.tulane.edu/trac/wiki/cypress/ModuleCommand#Program:module Module Command].)
     157
     158{{{
     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"
     161...
     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’
     164}}}
     165
     166The following excerpt is taken from the output in the R session of {{{> help("install.packages")}}}
     167
     168{{{
     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.
     175}}}