Error with H2O in R - Can't Connect to Local Host

Can't start H2O in R: Error in h2o.init() H2O failed to start, stopping execution

It turned out to be a proxy issue.
Unsetting the http_proxy environment variable allows R to properly connect to H2O, i.e.:

library(h2o)
Sys.unsetenv("http_proxy")
h2o.init()

H2O is not running yet, starting it now...

Note: In case of errors look at the following log files:
/tmp/RtmpqEIs7x/h2o_ferreen2_started_from_r.out
/tmp/RtmpqEIs7x/h2o_ferreen2_started_from_r.err

java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

Starting H2O JVM and connecting: . Connection successful!

R is connected to the H2O cluster:
H2O cluster uptime: 2 seconds 257 milliseconds
H2O cluster timezone: Europe/Zurich
H2O data parsing timezone: UTC
H2O cluster version: 3.22.1.1
H2O cluster version age: 1 month
H2O cluster name: H2O_started_from_R_enrico_azr433
H2O cluster total nodes: 1
H2O cluster total memory: 26.67 GB
H2O cluster total cores: 32
H2O cluster allowed cores: 32
H2O cluster healthy: TRUE
H2O Connection ip: localhost
H2O Connection port: 54321
H2O Connection proxy: NA
H2O Internal Security: FALSE
H2O API Extensions: XGBoost, Algos, AutoML, Core V3, Core V4
R Version: R version 3.5.0 (2018-04-23)

h2o failed to connect when called from R: Java version missmatch

The error you reported says:

Only Java 1.6-1.8 supported, version is 9

Seems like you have Java 9 installed, which is not yet supported by H2O. Use a compatible version of Java and that will fix the error.

If you can't or don't want to uninstall Java 9, then you'll need to tell H2O which Java you'd like to use by setting the JAVA_HOME environment variable. First, get the location of Java 1.8 by executing the following in a shell:

/usr/libexec/java_home -v 1.8

On my mac, it shows me this:

/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home

You can check if R can see your JAVA_HOME variable by running the following command: Sys.getenv("JAVA_HOME").

If that's blank (and possibly will be if you're using RStudio), then will have to do a bit more work to get R to see the JAVA_HOME variable. You can edit the ~/.Renviron file to add JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home or whatever that location is on your machine. Then restart RStudio and it should work.

H2O Initialisation error in R: Error in h2o.init(): H2O failed to start, stopping execution

Something is already listening on ports 54321 and/or 54322. (Or possibly you have a very tight firewall configuration that is stopping H2O server claiming those ports.)

I'd first try and eliminate any firewall issues. Then if you're sure that isn't it, you could try giving ip and/or port explicitly:

h2o.init(nthreads = -1, max_mem_size = '2g', ip = "127.0.0.1", port = 54321)

If that works it might be due to something about the ipv6 addresses you are using.

But if still no luck, try another port:

h2o.init(nthreads = -1, max_mem_size = '2g', ip = "127.0.0.1", port = 50001)

Security concerns with the H2O R package

From the documentation of h2o.init() (emphasis mine):

This method first checks if H2O is connectible. If it cannot connect and startH2O = TRUE with IP of localhost, it will attempt to start an instance of H2O with IP = localhost, port = 54321. Otherwise, it stops immediately with an error. When initializing H2O locally, this method searches for h2o.jar in the R library resources [...], and if the file does not exist, it will automatically attempt to download the correct version from Amazon S3. The user must have Internet access for this process to be successful. Once connected, the method checks to see if the local H2O R package version matches the version of H2O running on the server. If there is a mismatch and the user indicates she wishes to upgrade, it will remove the local H2O R package and download/install the H2O R package from the server.

So, h2o.init() with the default setting ip = "127.0.0.1", as here, connects the R session with the H2O instance (sometimes referred to as "server") in your local machine. If all the necessary package files are in place and up to date, no internet connection is necessary; the package will attempt to connect to the internet only to download stuff in case something is not present or up to date. No data is uploaded anywhere.



Related Topics



Leave a reply



Submit