I followed the steps given by the site (https://docs.h2o.ai/h2o/latest-stable/h2o-docs/downloading.html) and install the following:
pip install requests
pip install tabulate
pip install future
pip uninstall h2o
pip install -f http://h2o-release.s3.amazonaws.com/h2o/latest_stable_Py.html h2o
And the terminal return that "Successfully installed h2o-3.36.1.1".
However, when I run the code to optionally initialize H2O in Python and run a demo to see H2O at work, using this script:
import h2o
h2o.init()
h2o.demo("glm")
it returns this error:
Traceback (most recent call last):
File "C:\Users\Mary\Desktop\Algorithms\Algorithms\h2o.py", line 1, in <module>
import h2o
File "C:\Users\Mary\Desktop\Algorithms\h2o.py", line 2, in <module>
h2o.init()
AttributeError: partially initialized module 'h2o' has no attribute 'init' (most likely due to a circular import)
Could someone tell me why I can't run h2o? Thank you in advance.
CodePudding user response:
Try to change the name of the module you have created. There's a conflict.
CodePudding user response:
This is how import
works - it first searchs file h2o.py
in folder in which you run code. And if it can't find local h2o.py
then it searchs in folders with modules (in folders which you have on list sys.path
)
You created file h2o.py
so now import h2o
loads this file instead of module h20
and it can't find init
in your file.
You have to use different name for your file - ie. h2o_test.py
- and then it will load module h2o
Simply don't use names of modules as names of your files.