安装h2o /使用Java?

时间:2018-02-16 18:03:30

标签: java r h2o

一直试图安装h2o用于R并且已经打了多个缓冲区....

我似乎能够使用以下方法成功安装文件:

install.packages("~/Desktop/h2o_3.18.0.1.tar.gz", repos = NULL, type = "source")

退出

installing *source* package ‘h2o’ ...
R
demo
inst
preparing package for lazy loading
help
installing help indices
building package indices
testing if installed package can be loaded
DONE (h2o)

1。然后,当我打电话给h2o时,我得到一个错误(见下文),...我明白这可能是 因为它只适用于早期版本的java。这是正确的吗?

2。如果是这样......我该怎么办才能让R运行另一个版本的 java?

(我看到有人可以这样做而且是 描述这个,但我想知道是否有任何简明的指示?)

Error: package or namespace load failed for ‘h2o’ in get(Info[i, 1],
envir = env):
 lazy-load database
'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/h2o/R/h2o.rdb'
is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1

1 个答案:

答案 0 :(得分:1)

编辑如果您使用的是Java 9,但希望将Java 7或8用于H2O,则可以在运行Sys.setenv("JAVA_HOME", ...)之前尝试在R中运行h2o.init(),您可以在其中指定Java 7或8的路径,我将其保留为...

如果您有互联网连接,请尝试按照downloads page上的说明操作(选择在R标签中安装)

还请发布您拥有的Java版本。

基本上运行以下所有代码行:

# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }

# Next, we download packages that H2O depends on.
pkgs <- c("RCurl","jsonlite")
for (pkg in pkgs) {
if (! (pkg %in% rownames(installed.packages()))) { install.packages(pkg) }
}

# Now we download, install and initialize the H2O package for R.
install.packages("h2o", type="source", repos="http://h2o-release.s3.amazonaws.com/h2o/rel-wolpert/1/R")

# Finally, let's load H2O and start up an H2O cluster
library(h2o)
h2o.init()