在 Windows 上的 conda 虚拟环境中安装旧版本的 h2o

Installing older version of h2o in conda virtual environment on Windows

我正在努力找出 windows 上的 conda 虚拟环境。我想要的只是能够同时安装不同版本的 h2o,因为他们的疯狂决定不允许您加载保存在最小不同版本中的文件。

我通过克隆我的基本 anaconda 创建了一个虚拟环境:

conda create -n h203_14_0_7 --clone base

然后我像这样激活了虚拟环境:

C:\ProgramData\Anaconda3\Scripts\activate h203_14_0_7

现在我在虚拟环境中(看到提示开头的(h203_14_0_7)),我想卸载这个虚拟环境中的h2o版本所以我试了:

pip uninstall h2o

但是这个输出

在我看来,它将卸载全局 h2o 而不是虚拟环境 h2o。所以我认为它使用的是全局 pip 而不是它应该从基础克隆出来的 pip。那么我如何使用虚拟环境 pip 为我的虚拟环境卸载 h2o 以及我如何确定它在做正确的事情?

然后我运行

conda intall pip

似乎在那之后我只能使用 pip 从虚拟环境中卸载 h2o(我希望如此)。然后我从这里下载了旧的 h2o 版本:https://github.com/h2oai/h2o-3/releases/tag/jenkins-rel-weierstrass-7

但是当我尝试安装它时我得到

(h203_14_0_7) C:\ProgramData\Anaconda3\envs\h203_14_0_7>pip install C:\Users\dan25\Downloads\h2o-3-jenkins-rel-weierstrass-7.tar.gz
Processing c:\users\dan25\downloads\h2o-3-jenkins-rel-weierstrass-7.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\ProgramData\Anaconda3\envs\h203_14_0_7\lib\tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\dan25\AppData\Local\Temp\pip-sf7r_6pm-build\setup.py'

那现在呢?

安装requirements:

pip install requests tabulate numpy scikit-learn

提取存档:

zcat h2o-3-jenkins-rel-weierstrass-7.tar.gz | tar xvf -

cdPython directory 并构建:

cd h2o-py
../gradlew build

我很难(例如 https://0xdata.atlassian.net/browse/PUBDEV-3370 )让这种方法奏效。感觉好像有某种全局依赖性存在于某处。

因此,我个人只是卸载并安装所需的版本,因为我需要在版本之间移动。 (实际上,我更有可能为每个使用不同的 VirtualBox 或 AWS 图像。)

不过我注意到searching for conda on the H2O jira最近有很多activity。他们可能都指出了您发现的同一个错误,但如果是这样的话,这听起来像是引起了足够的关注以进行修复。

旁白: 查找旧版本(以及您的编辑显示安装问题)

查找,例如3.14.0.7,google 它与 "h2o"。最热门的是 http://h2o-release.s3.amazonaws.com/h2o/rel-weierstrass/7/index.html

中的"rel-weierstrass"代表3.14.0,7在URL中。 (我还没有看到所有 rel-XXX 名称的完整列表,但 google 总能在该系列中找到至少一个,即使找不到确切的次要版本。)

下载您在那里找到的 zip 文件。在里面你会发现 R 包和 Python 的 whl 包。所以解压它,提取你想要的那个,然后 pip 安装它。

这些 zip 文件始终位于 S3 (AFAIK) 上。您显示的 link 是 source 快照,在 github.

我现在有这个工作。我认为诀窍是确保您的底座上没有安装 h2o python。我做了以下事情:

pip uninstall h2o
conda create --name h2o-base pip
conda activate h2o-base
conda install numpy
conda install pandas
conda install requests
conda install tabulate
conda install colorama
conda install future
conda install jupyter
python -m pip install ipykernel
conda deactivate

现在要安装特定版本的 h2o,您需要 URL 该版本的 .whl 文件,您可以在此处找到所有旧版本的 URL 列表: https://github.com/h2oai/h2o-3/blob/master/Changes.md

例如安装版本 3.18.0.8:

conda create --name h2o-3-18-0-8 --clone h2o-base
conda activate h2o-3-18-0-8
pip install http://h2o-release.s3.amazonaws.com/h2o/rel-wolpert/8/Python/h2o-3.18.0.8-py2.py3-none-any.whl
python -m ipykernel install --user --name h2o-3-18-0-8 --display-name "Python (h2o-3-18-0-8)"

或版本 3.20.0.2(确保先 conda deactivate):

conda create --name h2o-3-20-0-2 --clone h2o-base
conda activate h2o-3-20-0-2
pip install http://h2o-release.s3.amazonaws.com/h2o/rel-wright/2/Python/h2o-3.20.0.2-py2.py3-none-any.whl
python -m ipykernel install --user --name h2o-3-20-0-2 --display-name "Python (h2o-3-20-0-2)"

此设置允许我在同一台计算机上安装多个版本的 h2o,如果我必须使用序列化模型,我只需要从虚拟环境 运行 python安装了正确版本的 h2o。我认为这比每次卸载并重新安装 h2o 更可取。

如果您想跳过上面的所有手动安装,这里是 environments.yml 文件:

name: h2o-base
channels:
  - conda-forge
  - defaults
dependencies:
  - asn1crypto=0.24.0=py37_1003
  - backcall=0.1.0=py_0
  - bleach=3.0.2=py_0
  - ca-certificates=2018.10.15=ha4d7672_0
  - certifi=2018.10.15=py37_1000
  - cffi=1.11.5=py37hfa6e2cd_1001
  - chardet=3.0.4=py37_1003
  - colorama=0.4.0=py_0
  - cryptography=2.3=py37h74b6da3_0
  - cryptography-vectors=2.3.1=py37_1000
  - decorator=4.3.0=py_0
  - entrypoints=0.2.3=py37_1002
  - future=0.16.0=py37_1002
  - icu=58.2=vc14_0
  - idna=2.7=py37_1002
  - ipykernel=5.1.0=pyh24bf2e0_0
  - ipython=7.0.1=py37h39e3cac_1000
  - ipython_genutils=0.2.0=py_1
  - ipywidgets=7.4.2=py_0
  - jedi=0.13.1=py37_1000
  - jinja2=2.10=py_1
  - jpeg=9b=vc14_2
  - jsonschema=2.6.0=py37_1002
  - jupyter=1.0.0=py_1
  - jupyter_client=5.2.3=py_1
  - jupyter_console=6.0.0=py_0
  - jupyter_core=4.4.0=py_0
  - libflang=5.0.0=vc14_20180208
  - libpng=1.6.34=vc14_0
  - libsodium=1.0.16=vc14_0
  - llvm-meta=5.0.0=0
  - markupsafe=1.0=py37hfa6e2cd_1001
  - mistune=0.8.4=py37hfa6e2cd_1000
  - nbconvert=5.3.1=py_1
  - nbformat=4.4.0=py_1
  - notebook=5.7.0=py37_1000
  - openblas=0.2.20=vc14_8
  - openmp=5.0.0=vc14_1
  - openssl=1.0.2p=hfa6e2cd_1001
  - pandas=0.23.4=py37h830ac7b_1000
  - pandoc=2.3.1=0
  - pandocfilters=1.4.2=py_1
  - parso=0.3.1=py_0
  - pickleshare=0.7.5=py37_1000
  - pip=18.1=py37_1000
  - prometheus_client=0.4.2=py_0
  - prompt_toolkit=2.0.6=py_0
  - pycparser=2.19=py_0
  - pygments=2.2.0=py_1
  - pyopenssl=18.0.0=py37_1000
  - pyqt=5.6.0=py37h764d66f_7
  - pysocks=1.6.8=py37_1002
  - python=3.7.0=hc182675_1005
  - python-dateutil=2.7.3=py_0
  - pytz=2018.5=py_0
  - pywinpty=0.5.4=py37_1002
  - pyzmq=17.1.2=py37hf576995_1001
  - qt=5.6.2=vc14_1
  - qtconsole=4.4.2=py_1
  - requests=2.19.1=py37_1001
  - send2trash=1.5.0=py_0
  - setuptools=40.4.3=py37_0
  - simplegeneric=0.8.1=py_1
  - sip=4.18.1=py37h6538335_0
  - six=1.11.0=py37_1001
  - tabulate=0.8.2=py_0
  - terminado=0.8.1=py37_1001
  - testpath=0.4.2=py37_1000
  - tornado=5.1.1=py37hfa6e2cd_1000
  - traitlets=4.3.2=py37_1000
  - urllib3=1.23=py37_1001
  - vc=14=0
  - vs2015_runtime=14.0.25420=0
  - wcwidth=0.1.7=py_1
  - webencodings=0.5.1=py_1
  - wheel=0.32.1=py37_0
  - widgetsnbextension=3.4.2=py37_1000
  - win_inet_pton=1.0.1=py37_1002
  - wincertstore=0.2=py37_1002
  - winpty=0.4.3=4
  - zeromq=4.2.5=vc14_2
  - zlib=1.2.11=vc14_0
  - blas=1.0=mkl
  - icc_rt=2017.0.4=h97af966_0
  - intel-openmp=2019.0=118
  - m2w64-gcc-libgfortran=5.3.0=6
  - m2w64-gcc-libs=5.3.0=7
  - m2w64-gcc-libs-core=5.3.0=7
  - m2w64-gmp=6.1.0=2
  - m2w64-libwinpthread-git=5.0.0.4634.697f757=2
  - mkl=2019.0=118
  - mkl_fft=1.0.6=py37hdbbee80_0
  - mkl_random=1.0.1=py37h77b88f5_1
  - msys2-conda-epoch=20160418=1
  - numpy=1.15.2=py37ha559c80_0
  - numpy-base=1.15.2=py37h8128ebf_0