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/04/05 21:11:53 UTC

[tvm] branch main updated: Add python installation script for Ubuntu 20.04 (#10841)

This is an automated email from the ASF dual-hosted git repository.

areusch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new c91e356a5d Add python installation script for Ubuntu 20.04 (#10841)
c91e356a5d is described below

commit c91e356a5deaf3388a751d9b9d9fbaf863d18279
Author: Mehrdad Hessar <mh...@octoml.ai>
AuthorDate: Tue Apr 5 14:11:44 2022 -0700

    Add python installation script for Ubuntu 20.04 (#10841)
---
 ...nstall_core.sh => ubuntu2004_install_python.sh} | 37 +++++++++++++---------
 docker/install/ubuntu_install_core.sh              | 13 ++++++--
 2 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/docker/install/ubuntu_install_core.sh b/docker/install/ubuntu2004_install_python.sh
similarity index 50%
copy from docker/install/ubuntu_install_core.sh
copy to docker/install/ubuntu2004_install_python.sh
index f9f03fb911..99cbd05ae9 100755
--- a/docker/install/ubuntu_install_core.sh
+++ b/docker/install/ubuntu2004_install_python.sh
@@ -20,19 +20,26 @@ set -e
 set -u
 set -o pipefail
 
-# install libraries for building c++ core on ubuntu
-apt-get update && apt-get install -y --no-install-recommends \
-        git make google-mock libgtest-dev cmake wget unzip libtinfo-dev libz-dev \
-        libcurl4-openssl-dev libssl-dev libopenblas-dev g++ sudo \
-        apt-transport-https graphviz pkg-config curl ninja-build parallel
 
-if [[ -d /usr/src/googletest ]]; then
-  # Single package source (Ubuntu 18.04)
-  # googletest is installed via libgtest-dev
-  cd /usr/src/googletest && cmake CMakeLists.txt && make && cp -v {googlemock,googlemock/gtest}/*.a /usr/lib
-else
-  # Split source package (Ubuntu 16.04)
-  # libgtest-dev and google-mock
-  cd /usr/src/gtest && cmake CMakeLists.txt && make && cp -v *.a /usr/lib
-  cd /usr/src/gmock && cmake CMakeLists.txt && make && cp -v *.a /usr/lib
-fi
+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-get install -y software-properties-common
+apt-get install -y python3.8 python3.8-dev python3-pip
+update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
+
+# Pin pip and setuptools versions
+# Hashes generated via:
+#   $ pip download <package>==<version>
+#   $ pip hash --algorithm sha512 <package>.whl
+cat <<EOF > base-requirements.txt
+pip==19.3.1 --hash=sha256:6917c65fc3769ecdc61405d3dfd97afdedd75808d200b2838d7d961cebc0c2c7
+setuptools==58.4.0 --hash=sha256:e8b1d3127a0441fb99a130bcc3c2bf256c2d3ead3aba8fd400e5cbbaf788e036
+EOF
+pip3 install -r base-requirements.txt
diff --git a/docker/install/ubuntu_install_core.sh b/docker/install/ubuntu_install_core.sh
index f9f03fb911..6cf02b5784 100755
--- a/docker/install/ubuntu_install_core.sh
+++ b/docker/install/ubuntu_install_core.sh
@@ -24,9 +24,18 @@ set -o pipefail
 apt-get update && apt-get install -y --no-install-recommends \
         git make google-mock libgtest-dev cmake wget unzip libtinfo-dev libz-dev \
         libcurl4-openssl-dev libssl-dev libopenblas-dev g++ sudo \
-        apt-transport-https graphviz pkg-config curl ninja-build parallel
+        apt-transport-https graphviz pkg-config curl ninja-build parallel \
+        lsb-core
 
-if [[ -d /usr/src/googletest ]]; then
+# Get Ubuntu version
+release=$(lsb_release -r)
+version_number=$(cut -f2 <<< "$release")
+
+if [ "$version_number" == "20.04" ]; then
+  # Single package source (Ubuntu 20.04)
+  # googletest is installed via libgtest-dev
+  cd /usr/src/googletest && cmake CMakeLists.txt && make && cp -v lib/*.a /usr/lib
+elif [ "$version_number" == "18.04" ]; then
   # Single package source (Ubuntu 18.04)
   # googletest is installed via libgtest-dev
   cd /usr/src/googletest && cmake CMakeLists.txt && make && cp -v {googlemock,googlemock/gtest}/*.a /usr/lib