我是H2o的新手。基于documentation我安装了H2o for python
$ pip install h2o
然后:
在:
import h2o
h2o.init()
输出:
OSError Traceback (most recent call last)
<ipython-input-1-07f8bb8f27db> in <module>()
1 import h2o
----> 2 h2o.init()
/usr/local/lib/python3.5/site-packages/h2o/h2o.py in init(ip, port, start_h2o, enable_assertions, license, nthreads, max_mem_size, min_mem_size, ice_root, strict_version_check, proxy, https, insecure, username, password, max_mem_size_GB, min_mem_size_GB, proxies, size)
849 nthreads=nthreads,max_mem_size=max_mem_size,min_mem_size=min_mem_size,ice_root=ice_root,
850 strict_version_check=strict_version_check,proxy=proxy,https=https,insecure=insecure,username=username,
--> 851 password=password,max_mem_size_GB=max_mem_size_GB,min_mem_size_GB=min_mem_size_GB,proxies=proxies,size=size)
852 return None
853
/usr/local/lib/python3.5/site-packages/h2o/connection.py in __init__(self, ip, port, start_h2o, enable_assertions, license, nthreads, max_mem_size, min_mem_size, ice_root, strict_version_check, proxy, https, insecure, username, password, max_mem_size_GB, min_mem_size_GB, proxies, size)
173 raise EnvironmentError("Version mismatch. H2O is version {0}, but the h2o-python package is version {1}. "
174 "This is a developer build, please contact your developer."
--> 175 "".format(ver_h2o, str(ver_pkg)))
176 else:
177 raise EnvironmentError("Version mismatch. H2O is version {0}, but the h2o-python package is version {1}. "
OSError: Version mismatch. H2O is version 3.8.2.99999, but the h2o-python package is version 3.8.2.6-1. This is a developer build, please contact your developer.
从website开始,我尝试按如下方式解决此问题:
h2o.shutdown
然后:
user@MacBook-Pro-of-User:~$ pip3 uninstall h2o
Uninstalling h2o-3.8.2.6-1:
/usr/local/h2o_data/iris.csv
/usr/local/h2o_data/prostate.csv
/usr/local/h2o_jar/h2o.jar
/usr/local/lib/python3.5/site-packages/h2o-3.8.2.6_1.dist-info/DESCRIPTION.rst
/usr/local/lib/python3.5/site-packages/h2o-3.8.2.6_1.dist-info/INSTALLER
/usr/local/lib/python3.5/site-packages/h2o-3.8.2.6_1.dist-info/METADATA
/usr/local/lib/python3.5/site-packages/h2o-3.8.2.6_1.dist-info/RECORD
/usr/local/lib/python3.5/site-packages/h2o-3.8.2.6_1.dist-info/WHEEL
/usr/local/lib/python3.5/site-packages/h2o-3.8.2.6_1.dist-info/metadata.json
/usr/local/lib/python3.5/site-packages/h2o-3.8.2.6_1.dist-info/top_level.txt
/usr/local/lib/python3.5/site-packages/h2o/__init__.py
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/assembly.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/astfun.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/connection.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/cross_validation.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/demo.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/display.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/expr.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/frame.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/group_by.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/h2o.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/h2o_logging.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/job.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/__pycache__/two_dim_table.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/assembly.py
/usr/local/lib/python3.5/site-packages/h2o/astfun.py
/usr/local/lib/python3.5/site-packages/h2o/connection.py
/usr/local/lib/python3.5/site-packages/h2o/cross_validation.py
/usr/local/lib/python3.5/site-packages/h2o/demo.py
/usr/local/lib/python3.5/site-packages/h2o/display.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/__init__.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/deeplearning.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/estimator_base.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/gbm.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/glm.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/glrm.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/kmeans.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/naive_bayes.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/__pycache__/random_forest.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/estimators/deeplearning.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/estimator_base.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/gbm.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/glm.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/glrm.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/kmeans.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/naive_bayes.py
/usr/local/lib/python3.5/site-packages/h2o/estimators/random_forest.py
/usr/local/lib/python3.5/site-packages/h2o/expr.py
/usr/local/lib/python3.5/site-packages/h2o/frame.py
/usr/local/lib/python3.5/site-packages/h2o/grid/__init__.py
/usr/local/lib/python3.5/site-packages/h2o/grid/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/grid/__pycache__/grid_search.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/grid/__pycache__/metrics.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/grid/grid_search.py
/usr/local/lib/python3.5/site-packages/h2o/grid/metrics.py
/usr/local/lib/python3.5/site-packages/h2o/group_by.py
/usr/local/lib/python3.5/site-packages/h2o/h2o.py
/usr/local/lib/python3.5/site-packages/h2o/h2o_logging.py
/usr/local/lib/python3.5/site-packages/h2o/job.py
/usr/local/lib/python3.5/site-packages/h2o/model/__init__.py
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/autoencoder.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/binomial.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/clustering.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/confusion_matrix.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/dim_reduction.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/metrics_base.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/model_base.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/model_builder.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/model_future.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/multinomial.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/__pycache__/regression.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/model/autoencoder.py
/usr/local/lib/python3.5/site-packages/h2o/model/binomial.py
/usr/local/lib/python3.5/site-packages/h2o/model/clustering.py
/usr/local/lib/python3.5/site-packages/h2o/model/confusion_matrix.py
/usr/local/lib/python3.5/site-packages/h2o/model/dim_reduction.py
/usr/local/lib/python3.5/site-packages/h2o/model/metrics_base.py
/usr/local/lib/python3.5/site-packages/h2o/model/model_base.py
/usr/local/lib/python3.5/site-packages/h2o/model/model_builder.py
/usr/local/lib/python3.5/site-packages/h2o/model/model_future.py
/usr/local/lib/python3.5/site-packages/h2o/model/multinomial.py
/usr/local/lib/python3.5/site-packages/h2o/model/regression.py
/usr/local/lib/python3.5/site-packages/h2o/transforms/__init__.py
/usr/local/lib/python3.5/site-packages/h2o/transforms/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/transforms/__pycache__/decomposition.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/transforms/__pycache__/preprocessing.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/transforms/__pycache__/transform_base.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/transforms/decomposition.py
/usr/local/lib/python3.5/site-packages/h2o/transforms/preprocessing.py
/usr/local/lib/python3.5/site-packages/h2o/transforms/transform_base.py
/usr/local/lib/python3.5/site-packages/h2o/two_dim_table.py
/usr/local/lib/python3.5/site-packages/h2o/utils/__init__.py
/usr/local/lib/python3.5/site-packages/h2o/utils/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/utils/__pycache__/shared_utils.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/h2o/utils/shared_utils.py
Proceed (y/n)? y
Successfully uninstalled h2o-3.8.2.6-1
user@MacBook-Pro-of-User:~$
然后我尝试升级到最新版本:
user@MacBook-Pro-of-User:~$ pip3 install http://h2o-release.s3.amazonaws.com/h2o/rel-turchin/6/Python/h2o-3.8.2.6-py2.py3-none-any.whl
但是,我收到了同样的错误消息:
OSError: Version mismatch. H2O is version 3.8.2.99999, but the h2o-python package is version 3.8.2.6. This is a developer build, please contact your developer.
如何为python正确安装h2o?。
答案 0 :(得分:4)
首先尝试使用最新版本的H2O:
pip3 uninstall h2o
pip3 install http://h2o-release.s3.amazonaws.com/h2o/rel-turchin/9/Python/h2o-3.8.2.9-py2.py3-none-any.whl
如果遇到同样的问题,请执行以下操作:
看起来你已经在你的机器上运行了H2O的开发版本(3.8.2.99999)。您将需要终止运行开发版本的H2O集群。您可以通过以下方式之一执行此操作:
一旦你杀死了现有的H2O集群,然后重新安装h2o模块,并直接从Python启动H2O集群,如下所示:
import h2o
h2o.init()
由于此时已经不存在运行的现有H2O集群,h2o Python模块将为您启动一个(并且因为您从Python启动它,它不会对版本感到困惑)。
有时候会发生的事情是人们单独下载H2O jar文件,启动H2O集群然后安装不同版本的R或Python软件包,这会导致不匹配错误。我想这可能是你问题的原因。通常启动H2O集群就像import h2o; h2o.init()
一样简单。
答案 1 :(得分:3)
尝试使用非默认端口号。例如:arr2.each_with_index.group_by { |h,i| arr2[i][i] }.
transform_values { |a| a.map { |_,i| arr1[i][i] } }
此错误可能是由于连接到版本错误的已经运行的H2O服务器引起的。当您运行h2o.init(port=8888)
时,它将首先检查在默认端口54321上运行的现有服务器。如果系统上的另一个用户在该端口上运行其他H2O版本,它将连接并引发版本冲突。>
答案 2 :(得分:0)
In order to use H2O, need to update the h20 jar file to python version.
删除磁盘上的H20版本并进行全新安装..然后pip install h20.
或按照以下说明操作:
答案 3 :(得分:0)
如果您打开h2o窗口@ http://localhost:54321,请确保在导入到python或python3之前将其关闭(Admin-&gt; shutDown),因为它们会产生冲突。
答案 4 :(得分:0)
默认情况下,H2O对于版本不匹配的情况非常宽容。
要解决此问题,您可以尝试执行此操作(不保证能成功!):
h2o.init(
strict_version_check=False
)