Verify R packages installed via init script

When you configure R packages to install via an init script, it is possible for a package install to fail if dependencies are not installed.

You can use the R commands in a notebook to check that all of the packages correctly installed.

Note

This article does require you to provide a list of packages to check against.

List installed packages

  1. Make a list of all R package names that you have listed in your init script or scripts.

  2. Enter the list of packages in this sample code.

    my_packages <- list("<package-1>", "<package-2>", "<package-3>" )
    find.package(my_packages, quiet=TRUE)
    
  3. The output is a list of all installed packages.

Verify the output against the input list to ensure that all packages were successfully installed.

List packages that did not install

  1. Make a list of all R package names that you have listed in your init script or scripts.

  2. Enter the list of packages in this sample code.

    my_packages <- c("<package-1>", "<package-2>", "<package-3>" )
    not_installed <- my_packages[!(my_packages %in% installed.packages()[ , "Package"])]
    print(not_installed)
    
  3. The output is a list of all packages that failed to install.

If you have packages that are consistently failing to install, you should enable cluster log delivery and review the cluster logs for failures.