简体   繁体   English

Python 在 anaconda 中找不到包 h2o

[英]Python cannot find package h2o in anaconda

When I try to import h2o I am told that the package does not exist.当我尝试导入 h2o 时,我被告知该包不存在。 When I try to install it, it tells me it already exists.当我尝试安装它时,它告诉我它已经存在。 I have tried wiping it out of my computer and reinstalling to no avail.我试过把它从我的电脑上擦除并重新安装,但无济于事。 At this point all I can think is some environment variable.在这一点上,我能想到的只是一些环境变量。

(C:\Users\Lanier\Anaconda2) C:\Users\Lanier>python
Python 2.7.12 |Anaconda custom (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import h2o
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named h2o
>>> quit()

(C:\Users\Lanier\Anaconda2) C:\Users\Lanier>conda install h2o
Fetching package metadata ...........
Solving package specifications: .

# All requested packages already installed.
# packages in environment at C:\Users\Lanier\Anaconda2:
#
h2o                       3.10.0.9                      0

(C:\Users\Lanier\Anaconda2) C:\Users\Lanier>

conda packages arn't language specific, in this case conda install h2o installs the java package. conda 包不是特定于语言的,在这种情况下conda install h2o安装 java 包。 You need to do conda install h2o-py你需要做conda install h2o-py

No idea why this worked on my old computer without the -py .不知道为什么这在没有-py旧计算机上有效。

我对conda install有同样的问题,但一切正常:

pip install h2o

If anyone still struggling with this issue, according to docs :如果有人仍在为这个问题苦苦挣扎,根据文档

H2O has tabulate>=0.75 as a dependency; H2O 具有制表>=0.75 作为依赖项; however, there is no tabulate available in the default channels for Python 3.6.但是,Python 3.6 的默认频道中没有可用的表格。 This is available in the conda-forge channel.这在 conda-forge 频道中可用。 As a result, Python 3.6 users must add the conda-forge channel in order to load the latest version of H2O.因此,Python 3.6 用户必须添加 conda-forge 通道才能加载最新版本的 H2O。

Thus, you have to follow the following steps:因此,您必须遵循以下步骤:
conda config --append channels conda-forge
This, will append the conda-forge channel to your available repositories.这会将 conda-forge 频道附加到您的可用存储库。
Then:然后:
conda install -c h2oai h2o
to install the needed packages.安装所需的软件包。

For python 3.7, the h2o library is not supporting as on Feb-2019.对于 python 3.7,自 2019 年 2 月起不支持 h2o 库。 So, I have created a new environment with 3.6 version and installed h2o using,因此,我创建了一个 3.6 版本的新环境并使用以下方法安装了 h2o,

conda install -c h2oai h2o -n <myenvname>

Suppose you are running on the Windows system, here is the way I resolved this issue:假设您在Windows系统上运行,这是我解决此问题的方法:

  1. Open your Anaconda Prompt.打开您的 Anaconda Prompt。

  2. Enter conda create -n py36 python=3.6 anaconda to create a channel with python 3.6.输入conda create -n py36 python=3.6 anaconda使用 python 3.6 创建通道。
    (which is often a neglected part, since up-to-date version is 3.83 while h2o module is only supported in 2.7,3.5,3.6) (这通常是一个被忽视的部分,因为最新版本是 3.83 而 h2o 模块仅在 2.7、3.5、3.6 中受支持)

  3. Enter activate py36 on the same screen to initiate a new channel named py36 .在同一屏幕上输入activate py36以启动一个名为py36的新频道。

  4. Enter config --append channels conda-forge in order to load the latest version of h2o.输入config --append channels conda-forge以加载最新版本的 h2o。

  5. Enter conda install -c h2oai h2o install the required modules including h20 and tabulate in the channel py36 .输入conda install -c h2oai h2o安装所需的模块,包括 h20 并在通道py36

  6. Exit the anaconda prompt , click on the anaconda-navigator application icon or type anaconda-navigator in your anaconda prompt.退出anaconda prompt ,单击 anaconda-navigator 应用程序图标或在 anaconda prompt 中键入anaconda-navigator

  7. Once you are on the main screen of anaconda-navigator, select py36 as the channel to run applications on the upper-left corner.进入anaconda-navigator的主界面后,在左上角选择py36作为运行应用程序的通道。
    (You may notice a bunch of random apps on your anaconda navigator, that's because conda forge is in your list of channels, you can either remove it by clicking on the delete button). (您可能会在 anaconda 导航器上注意到一堆随机应用程序,这是因为conda forge在您的频道列表中,您可以通过单击删除按钮将其删除)。

  8. Select any environment (Jupyter, Spyder, etc) on which you want to run your application, now you should be able to import h2o.选择您想要运行应用程序的任何环境(Jupyter、Spyder 等),现在您应该能够导入 h2o。

    Hope this answer helps you.希望这个回答对你有帮助。

Please use below command.. I was facing same issue.. but after executing below command issue got resolved.请使用下面的命令..我遇到了同样的问题..但是在执行下面的命令后问题得到了解决。

python -m pip install h2o python -m pip install h2o

OR if you are using python3 :或者,如果您使用的是 python3 :

python3 -m pip install h2o python3 -m pip install h2o

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM