Closed hfrick closed 1 year ago
Thanks @hfrick for reporting this. I didn't see this error message after searching the h2o codebase. I found this function .h2o.checkJava to be used for determining java installation though, which relies on Sys.getenv('JAVA_HOME')
and Sys.which('java')
. After I cleaned PATH I got the error
withr::with_path(
getwd(),
{
print(c(Sys.which("java"), Sys.getenv("JAVA_HOME")))
agua::h2o_start()
},
action = "replace"
)
#> java
#> "" ""
#> Registered S3 method overwritten by 'agua':
#> method from
#> tidy.workflow workflows
#> Error in .h2o.checkJava(): Cannot find Java. Please install the latest JRE from
#> https://www.oracle.com/technetwork/java/javase/downloads/index.html
Created on 2022-11-05 with reprex v2.0.2
Ah, thanks for this! So I do have java installed but I do not have JAVA_HOME
set. I put your example in a reprex and with the working directory as the path, I get the same as you. If I don't set that, as in the first part of the reprex below, it also errors but it only does so eventually. When I ran that first part interactively, I've never been patient enough to wait...
print(c(Sys.which("java"), Sys.getenv("JAVA_HOME")))
#> java
#> "/usr/bin/java" ""
agua::h2o_start()
#> Registered S3 method overwritten by 'agua':
#> method from
#> tidy.workflow workflows
#> Warning in system2(command, "-version", stdout = TRUE, stderr = TRUE): running
#> command ''/usr/bin/java' -version 2>&1' had status 1
#> Error in h2o::h2o.init(): H2O failed to start, stopping execution.
withr::with_path(
getwd(),
{
print(c(Sys.which("java"), Sys.getenv("JAVA_HOME")))
agua::h2o_start()
},
action = "replace"
)
#> java
#> "" ""
#> Error in .h2o.checkJava(): Cannot find Java. Please install the latest JRE from
#> https://www.oracle.com/technetwork/java/javase/downloads/index.html
Created on 2022-11-07 with reprex v2.0.2
What is the output if you run /usr/bin/java -version
from the command line? Seems this fails to locate java's version. The hanging is caused by https://github.com/h2oai/h2o-3/blob/master/h2o-r/h2o-package/R/connection.R#L217-L223 which tries to wait for 60 seconds before connection is established, agua could probabably do an early stop or add messages if previous commands fail.
yup, looks like it can't locate it
% /usr/bin/java -version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
an alternative to failing earlier than 60 seconds could also be telling the user that this step can take up to 60 seconds
fixed by 9922d26
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.
When I run
h2o_start()
without things installed/configured correctly, I do getbut then it just hangs there. It would be nice if that threw an error instead.