From c69133c4bb3487edf05c9f2a77861e89607b9f0e Mon Sep 17 00:00:00 2001 From: Ian Pittwood Date: Wed, 29 May 2024 07:58:43 -0600 Subject: [PATCH] Fix service image Python 3.12+ issues (#782) * Use `ensurepip` to make sure pip bundled with 3.12 is compatible * Add `ensurepip --upgrade` to install_python.sh * Downgrade WAML due to Azure ML Python 3.12 incompatibility --- docker-bake.hcl | 2 +- product/base/scripts/ubuntu/install_python.sh | 1 + workbench-for-google-cloud-workstations/Dockerfile.ubuntu2204 | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index 34209304..f9169170 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -189,7 +189,7 @@ variable WORKBENCH_GOOGLE_CLOUD_WORKSTATION_BUILD_MATRIX { variable WORKBENCH_MICROSOFT_AZURE_ML_BUILD_MATRIX { default = { builds = [ - {os = "ubuntu2204", r_primary = "4.4.0", r_alternate = "4.3.3", py_primary = "3.12.1", py_alternate = "3.11.7"}, + {os = "ubuntu2204", r_primary = "4.2.3", r_alternate = "4.1.3", py_primary = "3.9.17", py_alternate = "3.8.17"}, ] } } diff --git a/product/base/scripts/ubuntu/install_python.sh b/product/base/scripts/ubuntu/install_python.sh index f96d783a..13515ef7 100755 --- a/product/base/scripts/ubuntu/install_python.sh +++ b/product/base/scripts/ubuntu/install_python.sh @@ -94,6 +94,7 @@ install_python() { apt-get install $APT_ARGS "/tmp/python-${PYTHON_VERSION}.deb" rm "/tmp/python-${PYTHON_VERSION}.deb" # Upgrade pip and setuptools to latest version + $PYTHON_BIN -m ensurepip --upgrade $PYTHON_BIN -m pip install -U setuptools $PYTHON_BIN -m pip install -U pip } diff --git a/workbench-for-google-cloud-workstations/Dockerfile.ubuntu2204 b/workbench-for-google-cloud-workstations/Dockerfile.ubuntu2204 index 4398738b..9675ac76 100644 --- a/workbench-for-google-cloud-workstations/Dockerfile.ubuntu2204 +++ b/workbench-for-google-cloud-workstations/Dockerfile.ubuntu2204 @@ -59,10 +59,12 @@ RUN curl -O https://cdn.rstudio.com/python/ubuntu-2204/pkgs/python-${PYTHON_VERS && apt-get install -yq --no-install-recommends ./python-${PYTHON_VERSION_ALT}_1_amd64.deb \ && rm -rf python-${PYTHON_VERSION}_1_amd64.deb \ && rm -rf python-${PYTHON_VERSION_ALT}_1_amd64.deb \ + && /opt/python/${PYTHON_VERSION}/bin/python3 -m ensurepip --upgrade \ && /opt/python/${PYTHON_VERSION}/bin/python3 -m pip install 'virtualenv<20' \ && /opt/python/${PYTHON_VERSION}/bin/python3 -m pip install --upgrade setuptools \ && /opt/python/${PYTHON_VERSION}/bin/python3 -m pip install --upgrade pip \ && /opt/python/${PYTHON_VERSION}/bin/python3 -m pip cache purge \ + && /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m ensurepip --upgrade \ && /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip install 'virtualenv<20' \ && /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip install --upgrade setuptools \ && /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip install --upgrade pip \