You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ar...@apache.org on 2022/07/12 21:48:28 UTC
[tvm] 43/47: unify python installation script
This is an automated email from the ASF dual-hosted git repository.
areusch pushed a commit to branch areusch/freeze-dependencies
in repository https://gitbox.apache.org/repos/asf/tvm.git
commit 125147c155f8708bc533e2b66024f889fe64ddd3
Author: Andrew Reusch <ar...@gmail.com>
AuthorDate: Fri Jul 1 10:39:22 2022 -0700
unify python installation script
---
docker/Dockerfile.ci_arm | 4 +--
docker/Dockerfile.ci_cpu | 4 +--
docker/Dockerfile.ci_gpu | 4 +--
docker/Dockerfile.ci_hexagon | 6 ++--
docker/Dockerfile.ci_i386 | 4 +--
docker/Dockerfile.ci_lint | 4 +--
docker/Dockerfile.ci_py_deps | 4 +--
docker/Dockerfile.ci_qemu | 4 +--
docker/install/ubuntu1804_install_python.sh | 47 ------------------------
docker/install/ubuntu2004_install_python.sh | 45 -----------------------
docker/install/ubuntu_install_python.sh | 55 ++++++++++++++++++-----------
11 files changed, 51 insertions(+), 130 deletions(-)
diff --git a/docker/Dockerfile.ci_arm b/docker/Dockerfile.ci_arm
index 16dc6995a4..9f7d2a1f46 100644
--- a/docker/Dockerfile.ci_arm
+++ b/docker/Dockerfile.ci_arm
@@ -49,8 +49,8 @@ RUN bash /install/ubuntu_install_llvm.sh
ENV TVM_VENV /venv/apache-tvm-py3.7
COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
-RUN bash /install/ubuntu1804_install_python.sh
+COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
+RUN bash /install/ubuntu_install_python.sh
ENV PATH ${TVM_VENV}/bin:$PATH
# COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu
index 6aeb13ec9e..8c5e0b82e7 100644
--- a/docker/Dockerfile.ci_cpu
+++ b/docker/Dockerfile.ci_cpu
@@ -30,8 +30,8 @@ RUN bash /install/ubuntu_install_googletest.sh
ENV TVM_VENV /venv/apache-tvm-py3.7
COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
-RUN bash /install/ubuntu1804_install_python.sh
+COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
+RUN bash /install/ubuntu_install_python.sh
ENV PATH ${TVM_VENV}/bin:$PATH
COPY python/build/pyproject.toml /install/python/pyproject.toml
diff --git a/docker/Dockerfile.ci_gpu b/docker/Dockerfile.ci_gpu
index a29f097950..0c9d8ac108 100644
--- a/docker/Dockerfile.ci_gpu
+++ b/docker/Dockerfile.ci_gpu
@@ -37,8 +37,8 @@ RUN bash /install/ubuntu_install_googletest.sh
ENV TVM_VENV /venv/apache-tvm-py3.7
COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
-RUN bash /install/ubuntu1804_install_python.sh
+COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
+RUN bash /install/ubuntu_install_python.sh
ENV PATH ${TVM_VENV}/bin:$PATH
# COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
diff --git a/docker/Dockerfile.ci_hexagon b/docker/Dockerfile.ci_hexagon
index 2a33fc119c..7f0355a20d 100644
--- a/docker/Dockerfile.ci_hexagon
+++ b/docker/Dockerfile.ci_hexagon
@@ -32,10 +32,10 @@ RUN bash /install/ubuntu_install_core.sh
COPY install/ubuntu_install_googletest.sh /install/ubuntu_install_googletest.sh
RUN bash /install/ubuntu_install_googletest.sh
-ENV TVM_VENV /venv/apache-tvm-py3.7
+ENV TVM_VENV /venv/apache-tvm-py3.8
COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu2004_install_python.sh /install/ubuntu2004_install_python.sh
-RUN bash /install/ubuntu2004_install_python.sh
+COPY install/ubuntu_install_python.sh /install/ubuntu2004_install_python.sh
+RUN bash /install/ubuntu_install_python.sh
ENV PATH ${TVM_VENV}/bin:$PATH
# Rust env (build early; takes a while)
diff --git a/docker/Dockerfile.ci_i386 b/docker/Dockerfile.ci_i386
index db6d3aac36..94040d7764 100644
--- a/docker/Dockerfile.ci_i386
+++ b/docker/Dockerfile.ci_i386
@@ -45,8 +45,8 @@ RUN bash /install/ubuntu_install_tensorflow_deps.sh
ENV TVM_VENV /venv/apache-tvm-py3.7
COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
-RUN bash /install/ubuntu1804_install_python.sh
+COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
+RUN bash /install/ubuntu_install_python.sh
ENV PATH ${TVM_VENV}/bin:$PATH
COPY install/ubuntu_install_llvm.sh /install/ubuntu_install_llvm.sh
diff --git a/docker/Dockerfile.ci_lint b/docker/Dockerfile.ci_lint
index 14f1cc932a..c5d32f48a1 100644
--- a/docker/Dockerfile.ci_lint
+++ b/docker/Dockerfile.ci_lint
@@ -26,8 +26,8 @@ RUN apt-get update --fix-missing && apt-install-and-clear -y wget git sudo make
ENV TVM_VENV /venv/apache-tvm-py3.7
COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
-RUN bash /install/ubuntu1804_install_python.sh
+COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
+RUN bash /install/ubuntu_install_python.sh
ENV PATH ${TVM_VENV}/bin:$PATH
COPY python/build/pyproject.toml /install/python/pyproject.toml
diff --git a/docker/Dockerfile.ci_py_deps b/docker/Dockerfile.ci_py_deps
index 649e9e5146..8551db8bfc 100644
--- a/docker/Dockerfile.ci_py_deps
+++ b/docker/Dockerfile.ci_py_deps
@@ -24,8 +24,8 @@ RUN apt update --fix-missing && apt install sudo
COPY python/bootstrap-requirements.txt /install/python/bootstrap-requirements.txt
COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
-RUN bash /install/ubuntu1804_install_python.sh
+COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
+RUN bash /install/ubuntu_install_python.sh
# Globally disable pip cache
RUN pip config set global.no-cache-dir false
diff --git a/docker/Dockerfile.ci_qemu b/docker/Dockerfile.ci_qemu
index 6076853b12..05302192bd 100644
--- a/docker/Dockerfile.ci_qemu
+++ b/docker/Dockerfile.ci_qemu
@@ -29,8 +29,8 @@ RUN bash /install/ubuntu_install_googletest.sh
ENV TVM_VENV /venv/apache-tvm-py3.7
COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
-RUN bash /install/ubuntu1804_install_python.sh
+COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
+RUN bash /install/ubuntu_install_python.sh
ENV PATH ${TVM_VENV}/bin:$PATH
COPY python/build/pyproject.toml /install/python/pyproject.toml
diff --git a/docker/install/ubuntu1804_install_python.sh b/docker/install/ubuntu1804_install_python.sh
deleted file mode 100755
index 0acdd89b77..0000000000
--- a/docker/install/ubuntu1804_install_python.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-set -u
-set -o pipefail
-
-
-cleanup() {
- rm -rf base-requirements.txt
-}
-
-trap cleanup 0
-
-
-# Install python and pip. Don't modify this to add Python package dependencies,
-# instead modify install_python_package.sh
-apt-get update
-apt-install-and-clear -y software-properties-common
-# NOTE: There is no python3.7-pip, but whatever installed is upgraded anyway in a few lines.
-apt-install-and-clear -y python3.7 python3.7-dev python3-pip python3.7-venv
-update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
-
-# Update pip to match version used to produce requirements-hashed.txt. This step
-# is necessary so that pip's dependency solver is recent.
-pip_spec=$(cat /install/python/bootstrap/lockfiles/constraints.txt | grep 'pip==')
-pip3 install -U --require-hashes -r <(echo "${pip_spec}") \
- -c /install/python/bootstrap/lockfiles/constraints.txt
-pip3 config set global.no-cache-dir false
-
-# Now install the remaining base packages.
-pip3 install -r /install/python/bootstrap/lockfiles/constraints.txt
diff --git a/docker/install/ubuntu2004_install_python.sh b/docker/install/ubuntu2004_install_python.sh
deleted file mode 100755
index 4ab5e8d97d..0000000000
--- a/docker/install/ubuntu2004_install_python.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-set -u
-set -o pipefail
-
-
-cleanup() {
- rm -rf base-requirements.txt
-}
-
-trap cleanup 0
-
-# Install python and pip. Don't modify this to add Python package dependencies,
-# instead modify install_python_package.sh
-apt-get update
-apt-install-and-clear -y software-properties-common
-apt-install-and-clear -y python3.8 python3.8-dev python3-pip python3.8-venv
-update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
-
-# Update pip to match version used to produce requirements-hashed.txt. This step
-# is necessary so that pip's dependency solver is recent.
-pip_spec=$(cat /install/python/bootstrap/lockfiles/constraints.txt | grep 'pip==')
-pip3 install -U --require-hashes -r <(echo "${pip_spec}") \
- -c /install/python/bootstrap/lockfiles/constraints.txt
-pip3 config set global.no-cache-dir false
-
-# Now install the remaining base packages.
-pip3 install -r /install/python/bootstrap/lockfiles/constraints.txt
diff --git a/docker/install/ubuntu_install_python.sh b/docker/install/ubuntu_install_python.sh
index ec50682c14..f617e5872d 100755
--- a/docker/install/ubuntu_install_python.sh
+++ b/docker/install/ubuntu_install_python.sh
@@ -18,28 +18,41 @@
set -e
set -u
-# Used for debugging RVM build
-set -x
set -o pipefail
-# install python and pip, don't modify this, modify install_python_package.sh
-apt-get update
-apt-install-and-clear -y python-dev
-
-# python 3.6
-apt-install-and-clear -y software-properties-common
+set -x
-add-apt-repository -y ppa:deadsnakes/ppa
+release=$(lsb_release -sc)
+if [ "${release}" == "bionic" ]; then
+ PYTHON_VERSION=3.7
+elif [ "${release}" == "focal" ]; then
+ PYTHON_VERSION=3.8
+else
+ echo "Don't know which version of python to install for lsb-release ${release}"
+ exit 2
+fi
+
+# Install python and pip. Don't modify this to add Python package dependencies,
+# instead modify install_python_package.sh
apt-get update
-apt-install-and-clear -y python-pip python-dev python3.6 python3.6-dev
-
-rm -f /usr/bin/python3 && ln -s /usr/bin/python3.6 /usr/bin/python3
-
-# python 3.7
-apt-install-and-clear -y python3.7
-
-# Install pip
-wget -q https://bootstrap.pypa.io/get-pip.py && python3.7 get-pip.py
-
-# Pin pip and setuptools versions
-pip3 install pip==19.3.1 setuptools==58.4.0
+apt-install-and-clear -y software-properties-common
+apt-install-and-clear -y \
+ python${PYTHON_VERSION} \
+ python${PYTHON_VERSION}-dev \
+ python3-pip \
+ python${PYTHON_VERSION}-venv
+
+update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1
+
+# Update pip to match version used to produce requirements-hashed.txt. This step
+# is necessary so that pip's dependency solver is recent.
+pip_spec=$(cat /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt | grep 'pip==')
+pip3 install -U --require-hashes -r <(echo "${pip_spec}") \
+ -c /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt
+pip3 config set global.no-cache-dir false
+
+# Now install the remaining base packages.
+pip3 install \
+ --require-hashes \
+ -r /install/python/bootstrap/lockfiles/requirements-${PYTHON_VERSION}.txt \
+ -c /install/python/bootstrap/lockfiles/constraints-${PYTHON_VERSION}.txt