首页 > 解决方案 > 如何在 Anaconda R-essentials 中安装 H2O?

问题描述

我正在使用带有 R 的 Jupyter 笔记本,即在 Anaconda 中使用 R-essentials。但是,在 Jupyter notebook 中安装 H2O 包时,使用

install.packages("h2o")

它给出了错误并且无法安装它。我也试过

conda install c -r anaconda h20

在终端中,它确实安装了 h2o。但是在 r 笔记本中执行库函数时:

图书馆(水)

我收到以下错误消息:

Error in library(h2o): there is no package called ‘h2o’
Traceback:

1. library(h2o)
2. stop(txt, domain = NA)

请让我知道如何解决这个问题。

标签: ranacondajupyter-notebookh2o

解决方案


If you want to install h2o from within R please follow the download instructions here (this link will provide you with the latest stable version). for your convenience I am also pasting what is currently listed under the R tab (below):

Please also note that it looks like you ran h20 instead of h2o (like water) in conda install c -r anaconda h20 and in addition looking at the anaconda docs if you want to install an r package you need to pre-fix the package with an r-, and lastly if you want to install h2o from anaconda you should use the h2oai channel not the default anaconda channel. That being said if you do a search for the r-h2o package you will see if is not available for download in this manner conda search -f r-h2o so your best option is to install through R via the instructions pasted below.

Copy and paste these commands into R one line at a time:

# 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-xu/6/R")

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

推荐阅读