如何在使用 Docker 的 Vertex AI 中安装和使用 Python 3.9+?

huangapple go评论61阅读模式
英文:

How to install and use Python 3.9+ in Vertex AI using Docker?

问题

以下是翻译好的内容:

"我正在外部组织的GCP项目中工作,政策是没有公共互联网访问。我想使用一些Python模块,这些模块不包含在Vertex提供的DL容器中,所以唯一的选择是构建并推送一个Docker容器,安装这些模块,然后使用它创建一个Jupyter笔记本。

这里的问题是:我尝试安装需要至少Python 3.9的特定模块版本,这就是我现在卡住的地方。我已经成功使用这个作为我的Dockerfile中的参考来构建Python 3.9:

FROM gcr.io/deeplearning-platform-release/base-cpu:latest
RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository -y ppa:deadsnakes/ppa && \
    apt-get update && \
    apt install -y python3.9
RUN pip install gower
RUN pip install kmodes
RUN pip install ray
RUN pip install prince==0.9.0

但我在构建过程中遇到了这个错误:

> [6/6] RUN pip install prince==0.9.0:
#0 1.325 ERROR: 忽略了需要不同Python版本的以下版本:0.8.0 Requires-Python >=3.9,<4.0; 0.8.1 Requires-Python >=3.9,<4.0; 0.8.2 Requires-Python >=3.9,<4.0; 0.8.3 Requires-Python >=3.9,<4.0; 0.9.0 Requires-Python >=3.9,<4.0
#0 1.325 ERROR: 找不到满足要求prince==0.9.0的版本(来自版本:0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.7, 0.4.8, 0.4.9, 0.4.10, 0.5.2, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.7.0, 0.7.1)
#0 1.326 ERROR: 找不到匹配的发行版本prince==0.9.0

所以我认为它没有找到先前安装的Python版本,因此无法成功构建。我猜我漏掉了一些行或指令,这些可以让我正确构建并推送到Container Registry。任何反馈都会非常感激!"

英文:

So I am working in an external organization's GCP project, and the policy is that there is no public internet access available. I want to use some Python modules that are not contained in the DL containers that are available for Vertex, so the only option is to build and push a docker container that installs those modules for me, then use it to create a jupyter notebook.

Here's the catch: I am trying to install a certain module version that requires at least Python 3.9, and that's where I am stuck now. I've accomplished building with Python 3.9 using this as a reference in my Dockerfile:

FROM gcr.io/deeplearning-platform-release/base-cpu:latest
RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository -y ppa:deadsnakes/ppa && \
    apt-get update && \
    apt install -y python3.9
RUN pip install gower
RUN pip install kmodes
RUN pip install ray
RUN pip install prince==0.9.0

But I am getting this error during build:

> [6/6] RUN pip install prince==0.9.0:
#0 1.325 ERROR: Ignored the following versions that require a different python version: 0.8.0 Requires-Python >=3.9,<4.0; 0.8.1 Requires-Python >=3.9,<4.0; 0.8.2 Requires-Python >=3.9,<4.0; 0.8.3 Requires-Python >=3.9,<4.0; 0.9.0 Requires-Python >=3.9,<4.0
#0 1.325 ERROR: Could not find a version that satisfies the requirement prince==0.9.0 (from versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.7, 0.4.8, 0.4.9, 0.4.10, 0.5.2, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.7.0, 0.7.1)
#0 1.326 ERROR: No matching distribution found for prince==0.9.0

So I am assuming it is not finding the Python version previously installed and thus fails to build. I guess I am missing a couple of lines and/or instructions that would allow me to properly build and push this to Container Registry.

Any feedback is greatly appreciated!

答案1

得分: 1

我们发布版本 m105,其中包括 Python 3.10。https://cloud.google.com/deep-learning-containers/docs/release-notes

英文:

We release version m105 which includes Python 3.10. https://cloud.google.com/deep-learning-containers/docs/release-notes

huangapple
  • 本文由 发表于 2023年3月31日 23:59:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75900553.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定