pythondockergoogle-cloud-platformvertexgcp-ai-platform-notebook

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


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!


Solution

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