无法在 python 中启动 h2o - 但它在 R 中有效 - 连接被拒绝

Unable to launch h2o in python - but it works in R - connection refused

我正在尝试在 Python 中启动 h2o。我可以让它在 R 中工作,所以我不确定为什么它不能在 Python 中工作。以下是我从 Python.

收到的错误消息
#R
library(h2o)
h2o.init()
 everything goes great

#Python
import h2o
h2o.init()

error below






Checking whether there is an H2O instance running at http://localhost:54321..... not found.
Attempting to start a local H2O server...
  Java Version: java version "10.0.1" 2018-04-17; Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10); Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
  Starting server from /anaconda3/lib/python3.6/site-packages/h2o/backend/bin/h2o.jar
  Ice root: /var/folders/lj/gf5ntj5j2lq9tqwjx5yhxtw8000ym1/T/tmpawb7odqt



H2OConnectionError                        Traceback (most recent call last)
/anaconda3/lib/python3.6/site-packages/h2o/h2o.py in init(url, ip, port, https, insecure, username, password, cookies, proxy, start_h2o, nthreads, ice_root, enable_assertions, max_mem_size, min_mem_size, strict_version_check, ignore_config, extra_classpath, **kwargs)
    251                                      _msgs=("Checking whether there is an H2O instance running at {url}",
--> 252                                             "connected.", "not found."))
    253     except H2OConnectionError:

/anaconda3/lib/python3.6/site-packages/h2o/backend/connection.py in open(server, url, ip, port, https, auth, verify_ssl_certificates, proxy, cookies, verbose, _msgs)
    317             conn._timeout = 3.0
--> 318             conn._cluster = conn._test_connection(retries, messages=_msgs)
    319             # If a server is unable to respond within 1s, it should be considered a bug. However we disable this

/anaconda3/lib/python3.6/site-packages/h2o/backend/connection.py in _test_connection(self, max_retries, messages)
    587             raise H2OConnectionError("Could not establish link to the H2O cloud %s after %d retries\n%s"
--> 588                                      % (self._base_url, max_retries, "\n".join(errors)))
    589 

H2OConnectionError: Could not establish link to the H2O cloud http://localhost:54321 after 5 retries
[18:49.71] H2OConnectionError: Unexpected HTTP error: HTTPConnectionPool(host='localhost', port=54321): Max retries exceeded with url: /3/Cloud (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1189ba048>: Failed to establish a new connection: [Errno 61] Connection refused',))
[18:49.93] H2OConnectionError: Unexpected HTTP error: HTTPConnectionPool(host='localhost', port=54321): Max retries exceeded with url: /3/Cloud (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1208284e0>: Failed to establish a new connection: [Errno 61] Connection refused',))
[18:50.13] H2OConnectionError: Unexpected HTTP error: HTTPConnectionPool(host='localhost', port=54321): Max retries exceeded with url: /3/Cloud (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x120835da0>: Failed to establish a new connection: [Errno 61] Connection refused',))
[18:50.35] H2OConnectionError: Unexpected HTTP error: HTTPConnectionPool(host='localhost', port=54321): Max retries exceeded with url: /3/Cloud (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x120835240>: Failed to establish a new connection: [Errno 61] Connection refused',))
[18:50.56] H2OConnectionError: Unexpected HTTP error: HTTPConnectionPool(host='localhost', port=54321): Max retries exceeded with url: /3/Cloud (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x11fc01080>: Failed to establish a new connection: [Errno 61] Connection refused',))

During handling of the above exception, another exception occurred:

H2OServerError                            Traceback (most recent call last)
<ipython-input-198-95453bf1556d> in <module>()
----> 1 h2o.init()

/anaconda3/lib/python3.6/site-packages/h2o/h2o.py in init(url, ip, port, https, insecure, username, password, cookies, proxy, start_h2o, nthreads, ice_root, enable_assertions, max_mem_size, min_mem_size, strict_version_check, ignore_config, extra_classpath, **kwargs)
    259             raise H2OConnectionError('Can only start H2O launcher if IP address is localhost.')
    260         hs = H2OLocalServer.start(nthreads=nthreads, enable_assertions=enable_assertions, max_mem_size=mmax,
--> 261                                   min_mem_size=mmin, ice_root=ice_root, port=port, extra_classpath=extra_classpath)
    262         h2oconn = H2OConnection.open(server=hs, https=https, verify_ssl_certificates=not insecure,
    263                                      auth=auth, proxy=proxy,cookies=cookies, verbose=True)

/anaconda3/lib/python3.6/site-packages/h2o/backend/server.py in start(jar_path, nthreads, enable_assertions, max_mem_size, min_mem_size, ice_root, port, extra_classpath, verbose)
    119         if verbose: print("Attempting to start a local H2O server...")
    120         hs._launch_server(port=port, baseport=baseport, nthreads=int(nthreads), ea=enable_assertions,
--> 121                           mmax=max_mem_size, mmin=min_mem_size)
    122         if verbose: print("  Server is running at %s://%s:%d" % (hs.scheme, hs.ip, hs.port))
    123         atexit.register(lambda: hs.shutdown())

/anaconda3/lib/python3.6/site-packages/h2o/backend/server.py in _launch_server(self, port, baseport, mmax, mmin, ea, nthreads)
    306         while True:
    307             if proc.poll() is not None:
--> 308                 raise H2OServerError("Server process terminated with error code %d" % proc.returncode)
    309             ret = self._get_server_info_from_logs()
    310             if ret:

H2OServerError: Server process terminated with error code 1

任何人都可以给我一些关于如何解决这个问题的具体建议吗?我正在使用 Python.

的最新稳定版本

更改Java版本。 使用java 8.

确保您拥有所有依赖项:

pip 安装请求列表 "colorama>=0.3.8" 未来

并从这里安装 H2O:

pip install -f http://h2o-release.s3.amazonaws.com/h2o/latest_stable_Py.html h2o

它对我有用,没有错误。