From 7cb341db253bca8c86496e6e9d14856464a2051b Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Fri, 3 Jan 2025 11:30:43 +0900 Subject: [PATCH 1/4] build: install Python 3.12 on Linux image --- docker/linux/x86_64/Dockerfile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docker/linux/x86_64/Dockerfile b/docker/linux/x86_64/Dockerfile index 5cfb1db1a..1130daf6a 100644 --- a/docker/linux/x86_64/Dockerfile +++ b/docker/linux/x86_64/Dockerfile @@ -54,6 +54,15 @@ RUN curl https://apt.llvm.org/llvm.sh -o llvm.sh && \ ln -sf /usr/bin/clang++-16 /usr/bin/clang++ && \ ln -sf /usr/bin/clang-format-16 /usr/bin/clang-format +# Install Python 3.12 +RUN add-apt-repository ppa:deadsnakes/ppa -y && \ + apt-get update && \ + apt-get install -y --no-install-recommends python3.12 python3.12-dev python3.12-venv python3-pip && \ + curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3.12 get-pip.py && \ + update-alternatives --install /usr/local/bin/python python /usr/bin/python3.12 10 + + FROM base AS android WORKDIR /tmp @@ -86,13 +95,6 @@ WORKDIR /tmp # install Android SDK and NDK COPY --from=android /opt/android /opt/android -# Setup Python -RUN apt-get install -y --no-install-recommends python3.9 python3.9-dev python3.9-distutils && \ - curl -L https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ - python3.9 get-pip.py && \ - update-alternatives --install /usr/local/bin/python python /usr/bin/python3.9 10 && \ - update-alternatives --install /usr/local/bin/pip pip /usr/local/bin/pip3.9 10 - # Install NuGet RUN gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list && \ @@ -133,7 +135,7 @@ ENV NPM_PREFIX /home/mediapipe/.npm-packages ENV PATH ${NPM_PREFIX}/bin:/home/mediapipe/.local/bin:${PATH} # install numpy -RUN pip install --no-cache-dir --user numpy +RUN python -m pip install --no-cache-dir --user numpy FROM builder @@ -142,7 +144,7 @@ ARG ANDROID_NDK_VERSION ENV ANDROID_HOME /opt/android ENV ANDROID_NDK_HOME /opt/android/ndk/${ANDROID_NDK_VERSION} -ENV PYTHON_BIN_PATH /usr/bin/python3.9 +ENV PYTHON_BIN_PATH /usr/bin/python3.12 COPY packages.config . COPY .bazelrc . From 29d596bfb46b654a82009134687ed74bb0c8246b Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Fri, 3 Jan 2025 11:31:12 +0900 Subject: [PATCH 2/4] chore: fix ENV format --- docker/linux/x86_64/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker/linux/x86_64/Dockerfile b/docker/linux/x86_64/Dockerfile index 1130daf6a..613b4be1f 100644 --- a/docker/linux/x86_64/Dockerfile +++ b/docker/linux/x86_64/Dockerfile @@ -71,8 +71,8 @@ ARG ANDROID_SDK_BUILD_TOOLS_VERSION ARG ANDROID_SDK_VERSION ARG ANDROID_NDK_VERSION -ENV COMMANDLINETOOLS_ZIP commandlinetools.zip -ENV COMMANDLINETOOLS_SHA256 124f2d5115eee365df6cf3228ffbca6fc3911d16f8025bebd5b1c6e2fcfa7faf +ENV COMMANDLINETOOLS_ZIP=commandlinetools.zip +ENV COMMANDLINETOOLS_SHA256=124f2d5115eee365df6cf3228ffbca6fc3911d16f8025bebd5b1c6e2fcfa7faf RUN curl -L https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip -o ${COMMANDLINETOOLS_ZIP} && \ @@ -131,8 +131,8 @@ RUN addgroup wheel && useradd -u ${UID} -m mediapipe && usermod -aG wheel mediap USER mediapipe WORKDIR /home/mediapipe -ENV NPM_PREFIX /home/mediapipe/.npm-packages -ENV PATH ${NPM_PREFIX}/bin:/home/mediapipe/.local/bin:${PATH} +ENV NPM_PREFIX=/home/mediapipe/.npm-packages +ENV PATH=${NPM_PREFIX}/bin:/home/mediapipe/.local/bin:${PATH} # install numpy RUN python -m pip install --no-cache-dir --user numpy @@ -142,9 +142,9 @@ FROM builder ARG ANDROID_NDK_VERSION -ENV ANDROID_HOME /opt/android -ENV ANDROID_NDK_HOME /opt/android/ndk/${ANDROID_NDK_VERSION} -ENV PYTHON_BIN_PATH /usr/bin/python3.12 +ENV ANDROID_HOME=/opt/android +ENV ANDROID_NDK_HOME=/opt/android/ndk/${ANDROID_NDK_VERSION} +ENV PYTHON_BIN_PATH=/usr/bin/python3.12 COPY packages.config . COPY .bazelrc . From 140394702237276fb2f7619442c6206736c94cf9 Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Fri, 3 Jan 2025 11:32:21 +0900 Subject: [PATCH 3/4] build: install Python 3.12 on Windows image --- docker/windows/x86_64/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/windows/x86_64/Dockerfile b/docker/windows/x86_64/Dockerfile index 7868b01d9..64728f529 100644 --- a/docker/windows/x86_64/Dockerfile +++ b/docker/windows/x86_64/Dockerfile @@ -1,7 +1,7 @@ # escape=` ARG NODE_VERSION=18.17.1 -ARG PYTHON_VERSION=3.9.9 +ARG PYTHON_VERSION=3.12.8 ARG ANDROID_SDK_VERSION=30 ARG ANDROID_NDK_VERSION=21.4.7075529 From 153d7fb30dd2740b9190d447e38b2f387d26c1d9 Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Fri, 3 Jan 2025 11:34:50 +0900 Subject: [PATCH 4/4] ci: use python 3.12 --- .github/workflows/linux-test.yml | 2 +- .github/workflows/macos-test.yml | 2 +- .github/workflows/package.yml | 4 ++-- .github/workflows/windows-test.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux-test.yml b/.github/workflows/linux-test.yml index ef5b7bf3e..56f2c7b9b 100644 --- a/.github/workflows/linux-test.yml +++ b/.github/workflows/linux-test.yml @@ -58,7 +58,7 @@ jobs: - uses: actions/setup-python@v5 if: steps.cache-libs.outputs.cache-hit != 'true' with: - python-version: '3.10' + python-version: '3.12' - name: Install dependencies if: steps.cache-libs.outputs.cache-hit != 'true' diff --git a/.github/workflows/macos-test.yml b/.github/workflows/macos-test.yml index eef82eb63..183fc041b 100644 --- a/.github/workflows/macos-test.yml +++ b/.github/workflows/macos-test.yml @@ -58,7 +58,7 @@ jobs: - uses: actions/setup-python@v5 if: steps.cache-libs.outputs.cache-hit != 'true' with: - python-version: '3.10' + python-version: '3.12' - name: Install NumPy if: steps.cache-libs.outputs.cache-hit != 'true' run: pip install --no-cache-dir --user numpy diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index dd0b089d1..3618aa87f 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -116,7 +116,7 @@ jobs: # Setup Python - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.12' - name: Install NumPy run: pip install --no-cache-dir --user numpy @@ -141,7 +141,7 @@ jobs: # Setup Python - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.12' - name: Install NumPy run: pip install --no-cache-dir --user numpy diff --git a/.github/workflows/windows-test.yml b/.github/workflows/windows-test.yml index 9016fe618..f85dc4f1e 100644 --- a/.github/workflows/windows-test.yml +++ b/.github/workflows/windows-test.yml @@ -54,7 +54,7 @@ jobs: - uses: actions/setup-python@v5 if: steps.cache-libs.outputs.cache-hit != 'true' with: - python-version: '3.10' + python-version: '3.12' - name: Install NumPy if: steps.cache-libs.outputs.cache-hit != 'true' run: pip install --no-cache-dir --user numpy