code: def main():
      print("Installing R package 'guildai'")
      install_script = """
          if (file.access(.libPaths()[[1L]], 2) != 0L)
          local({
              # if default lib not writable, try create user lib dir
              userlibs <- strsplit(Sys.getenv("R_LIBS_USER"), .Platform$path.sep)[[1L]]
              if (!length(userlibs)) return()
              if (userlibs[[1L]] == "NULL") return()
              dir.create(userlibs[[1L]], recursive = TRUE, showWarnings = FALSE)
              .libPaths(userlibs[[1L]])
          })
  
          local({
              repos <- getOption("repos")
              if (identical(repos["CRAN"], "@CRAN@")) {
                  repos["CRAN"] <- "https://cran.rstudio.com/"
                  options(repos = repos)
              }
          })
  
          install_dev_version <- TRUE
  
          if (install_dev_version) {
              if (!require("remotes", quietly = TRUE)) {
                  utils::install.packages("remotes")
              }
              remotes::install_github("guildai/guildai-r")
          } else {
              utils::install.packages("guildai")
          }
      """
  
      try:
          r_util.run_r(infile=install_script)
      except r_util.RScriptProcessError as e:
          _install_error(e)
  
imports: import sys
  import typing
  from guild.plugins import r_util
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types