I had just removed Java 16 from my Mac (downgrade to Java 11) in order to run H2O. H2O cluster is finally able to connect after running h2o.init()
.
However, I run into an error right after trying to import a CSV file using h2o.importFile()
. I have checked that the file is in my R default working directory and running a read.csv()
of the same file works. Does anyone know the fix for this? Thank you very much in advance for your help!
Java version:
java version "11.0.10" 2021-01-19 LTS.
Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162).
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.10+8-LTS-162, mixed mode)
The code entered is:
sample <- read.csv("sample_csv.csv") #able to read file
library(h2o)
h2o.init()
data.h2o <- h2o.importFile("sample_csv.csv") #error
The error message:
Connection successful!
R is connected to the H2O cluster:
H2O cluster uptime: 13 hours 41 minutes
H2O cluster timezone: Asia/Singapore
H2O data parsing timezone: UTC
H2O cluster version: 3.32.0.1
H2O cluster version age: 5 months and 21 days !!!
H2O cluster name: H2O_started_from_R_User_pmr248
H2O cluster total nodes: 1
H2O cluster total memory: 4.00 GB
H2O cluster total cores: 16
H2O cluster allowed cores: 16
H2O cluster healthy: TRUE
H2O Connection ip: localhost
H2O Connection port: 54321
H2O Connection proxy: NA
H2O Internal Security: FALSE
H2O API Extensions: Amazon S3, XGBoost, Algos, AutoML, Core V3, TargetEncoder, Core V4
R Version: R version 4.0.4 (2021-02-15)
Your H2O cluster version is too old (5 months and 21 days)!
Please download and install the latest version from http://h2o.ai/download/.
ERROR: Unexpected HTTP Status code: 404 Not Found (url = http://localhost:54321/3/ImportFiles?path=sample_csv.csv&pattern=)
water.exceptions.H2ONotFoundArgumentException
[1] "water.exceptions.H2ONotFoundArgumentException: File sample_csv.csv does not exist"
[2] " water.persist.PersistNFS.importFiles(PersistNFS.java:127)"
[3] " water.persist.PersistManager.importFiles(PersistManager.java:386)"
[4] " water.api.ImportFilesHandler.importFiles(ImportFilesHandler.java:25)"
[5] " jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)"
[6] " java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
[7] " java.base/java.lang.reflect.Method.invoke(Method.java:566)"
[8] " water.api.Handler.handle(Handler.java:60)"
[9] " water.api.RequestServer.serve(RequestServer.java:470)"
[10] " water.api.RequestServer.doGeneric(RequestServer.java:301)"
[11] " water.api.RequestServer.doGet(RequestServer.java:225)"
[12] " javax.servlet.http.HttpServlet.service(HttpServlet.java:687)"
[13] " javax.servlet.http.HttpServlet.service(HttpServlet.java:790)"
[14] " org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)"
[15] " org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)"
[16] " org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)"
[17] " org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317)"
[18] " org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)"
[19] " org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)"
[20] " org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)"
[21] " org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)"
[22] " org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)"
[23] " org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)"
[24] " org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)"
[25] " water.webserver.jetty9.Jetty9ServerAdapter$LoginHandler.handle(Jetty9ServerAdapter.java:130)"
[26] " org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)"
[27] " org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)"
[28] " org.eclipse.jetty.server.Server.handle(Server.java:531)"
[29] " org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)"
[30] " org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)"
[31] " org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)"
[32] " org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)"
[33] " org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)"
[34] " org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)"
[35] " org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)"
[36] " org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)"
[37] " org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)"
[38] " org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)"
[39] " org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)"
[40] " org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)"
[41] " java.base/java.lang.Thread.run(Thread.java:834)"
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, : ERROR MESSAGE: File sample_csv.csv does not exist
Please try to use absolute path to the
sample_csv.csv
. R tells H2O to read the file but the current working directory of H2O process is different from R's and in H2O's current working directory is no file namedsample_csv.csv
.It might seem easy to make this work reliably even with relative paths but it is important to realize that H2O might be running on some different computer where the relative path would be correct but it wouldn't be on the R client's side.