r语言 - Windows 错误 [5]:访问被拒绝 H2o 使用 Python 的深度学习框架初始化



我正在使用Windows 10,Anaconda 2.4.1和Python 2.7.11,并尝试从oxdata运行h2o包。

为了安装 h2o,我使用了:

pip install h2o

我正在尝试按照 H2o 包的 Python 小插图中给出的方式初始化它。

import h2o
h2o.init()

但是我得到了一个很长的回溯,提到了Windows错误[5],如下所示:

    No instance found at ip and port: localhost:54321. Trying to start local jar...

JVM stdout: c:usersashishappdatalocaltemptmpech694h2o_Ashish_started_from_python.out
JVM stderr: c:usersashishappdatalocaltemptmp7aoezah2o_Ashish_started_from_python.err
Using ice_root: c:usersashishappdatalocaltemptmpjijmdl
Traceback (most recent call last):
  File "<ipython-input-2-e7cfdc50af66>", line 1, in <module>
    h2o.init()
  File "C:UsersAshishAnaconda2libsite-packagesh2oh2o.py", line 668, in init
    H2OConnection(ip=ip, port=port,start_h2o=start_h2o,enable_assertions=enable_assertions,license=license,max_mem_size_GB=max_mem_size_GB,min_mem_size_GB=min_mem_size_GB,ice_root=ice_root,strict_version_check=strict_version_check)
  File "C:UsersAshishAnaconda2libsite-packagesh2oconnection.py", line 81, in __init__
    cld = self._start_local_h2o_jar(max_mem_size_GB, min_mem_size_GB, enable_assertions, license, ice_root, jar_path)
  File "C:UsersAshishAnaconda2libsite-packagesh2oconnection.py", line 181, in _start_local_h2o_jar
    jver = subprocess.check_output([command, "-version"], stderr=subprocess.STDOUT)
  File "C:UsersAshishAnaconda2libsubprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:UsersAshishAnaconda2libsubprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:UsersAshishAnaconda2libsubprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 5] Access is denied

但是如果我使用 R 语言安装 h2o 包

install.packages("h2o")

然后尝试在 R 中运行

library(h2o)
h <- h2o.init()

没有错误,h2o 在本地主机和端口 54321 上完美启动。

另外,现在如果在python中启动h2o,即在python中

h2o.init()

然后它连接到已经在运行的 h2o 实例并毫无问题地执行所有操作。

但是我想避免预启动h2o实例的步骤,并希望使用python启动它。我不知道我的问题是否可以在其他人的系统上重现。

我只是想使用

import h2o
h2o.init()

在 Python 中启动 H2O。

请尝试提供解决方案。

我尝试使用以下代码解决我的问题。

"""
Code to initialize H2O instance
@author: Naimish Agarwal
"""
import subprocess as sp
import sys
import os.path as p
import h2o
# path of h2o jar file
h2o_path = p.join(sys.prefix, "h2o_jar", "h2o.jar")
# subprocess to launch h2o
# the command can be further modified to include virtual machine parameters
sp.Popen("java -jar " + h2o_path)
# h2o.init() call to verify that h2o launch is successfull
h2o.init()

它产生了以下输出:

--------------------------  --------------------------
H2O cluster uptime:         2 seconds 603 milliseconds
H2O cluster version:        3.6.0.8
H2O cluster name:           Ashish
H2O cluster total nodes:    1
H2O cluster total memory:   3.54 GB
H2O cluster total cores:    4
H2O cluster allowed cores:  4
H2O cluster healthy:        True
H2O Connection ip:          127.0.0.1
H2O Connection port:        54321
--------------------------  --------------------------

相关内容

  • 没有找到相关文章

最新更新