OSError: Version mismatch while installing h2o?

2020-05-01 02:29发布

问题:

I am new with H2o. Based in the documentation I installed H2o for python

$ pip install h2o

Then:

In:

import h2o
h2o.init()

Out:


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.

From this website, I tried to solve this issue as follows:

h2o.shutdown

Then:

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:~$

Then I tried to upgrade to the latest version:

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

However, I got the same error message:

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.

How to correctly install h2o for python?.

回答1:

First try again with the latest version of 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

If you run into the same issue, then do the following:

It looks like you already have a development version of H2O running on your machine (3.8.2.99999). You will need to kill that H2O cluster that is running the dev version. You can do that one of the following ways:

  • Navigate to the H2O Flow web GUI (if you are running locally, that would be at localhost:54321 by default). In the GUI, click on the Admin menu item and then click on "Shut Down."
  • Kill the Java process that is running the H2O cluster.

Once you have killed the existing H2O cluster, then reinstall the h2o module, and start the H2O cluster directly from Python as follows:

import h2o
h2o.init()

Since at this point, there won't be an existing H2O cluster running, the h2o Python module will start one up for you (and since you started it from Python, it won't get confused about versions).

Sometimes what happens is that people download the H2O jar file separately, start an H2O cluster and then install a different version of the R or Python package, which causes the mismatch error. I think this may be the cause of your issue. Usually starting an H2O cluster is as simple as import h2o; h2o.init().



回答2:

Try using a non-default port number. For example: h2o.init(port=8888)

This error can be caused by connecting to an already running H2O server that is the wrong version. When you run h2o.init() it first checks for an existing server running on the default port, 54321. If another user on your system is running a different H2O version on that port, it will connect and throw the version clash.



回答3:

If you have the h2o window opened @ http://localhost:54321 , make sure you shut it down (Admin->shutDown) before you import into python or python3 since they create conflicts.



回答4:

In order to use H2O, need to update the h20 jar file to python version. 

Delete H20 versions on disk and do a fresh install.. Then pip install h20.

Or follow these instructions:

http://www.h2o.ai/download/h2o/python



回答5:

By default, H2O is very unforgiving about version mismatches.

to work around the problem, you can try this (not guaranteed to work!):

 h2o.init(
    strict_version_check=False
)