Megan Kurka

February 14, 2019

Goal

The goal of this article is to provide steps for maintaining multiple versions of H2O on a single R instance. This can help when users are starting different versions of H2O on Enterprise Steam but are still connecting to the cluster via the same R server.


Proposal

The proposal consists of making directories for each version of H2O. In this example, I will save all H2O versions in my directory: /Users/megankurka/H2O_R_Packages


Step 1: Uninstall H2O-R

As a first step, we will uninstall any general h2o-R libraries. By removing it, we prevent a user from accidentally loading this H2O package.

if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }

Step 2: Make directory for specific version of H2O

In this example, I use R to create the directory: /Users/megankurka/H2O_R_Packages. This is where I will save all h2o R versions. This step can also be done in the command line.

h2o_pcks_dir <- "/Users/megankurka/H2O_R_Packages"
dir.create(file.path(h2o_pcks_dir, "h2o_3.22.1.3"))
library_path <- file.path(h2o_pcks_dir, "h2o_3.22.1.3")

print(library_path)
## [1] "/Users/megankurka/H2O_R_Packages/h2o_3.22.1.3"

I will be installing the H2O R package for version 3.22.1.3 and all dependencies in this folder.

Step 3: Install H2O package to directory

Now we can install any dependencies and the H2O package. The steps will be the same as shown in the https://www.h2o.ai/download/ page under the R tab. The only changes we are making is adding an additional argument to any installed.packages or install.packages function called lib that provides the library path.

# Install dependencies
pkgs <- c("RCurl","jsonlite")
for (pkg in pkgs) {
  if (! (pkg %in% rownames(installed.packages(lib = library_path)))) { install.packages(pkg, lib = library_path) }
}

# Install h2o package
install.packages("h2o", type="source", 
                 repos="http://h2o-release.s3.amazonaws.com/h2o/rel-xu/3/R",
                 lib = library_path)

Step 4: Load the H2O library

Now that H2O was successfully installed, we can load the H2O library. The only changes made for the end users are that they now need to specify the library_path with the location of the version they are interested in using.

library('h2o', lib.loc = library_path)