From ca62746c7b57cc846a58cb4cbde1000645a00039 Mon Sep 17 00:00:00 2001 From: Amit Patankar Date: Thu, 3 Dec 2020 16:22:05 -0800 Subject: [PATCH] Fix the MacOS tf-nightly releases. PiperOrigin-RevId: 345559297 Change-Id: I6c159b43f64c09bb8c432a1d636d9c7c4a1f6040 --- .../nightly_release/macos/cpu_py36.sh | 2 + .../nightly_release/macos/cpu_py37.sh | 2 + .../nightly_release/macos/cpu_py38.sh | 2 + .../ci_build/presubmit/macos/py37_cc/build.sh | 2 +- tensorflow/tools/ci_build/release/common.sh | 82 +++++++------------ 5 files changed, 35 insertions(+), 55 deletions(-) diff --git a/tensorflow/tools/ci_build/nightly_release/macos/cpu_py36.sh b/tensorflow/tools/ci_build/nightly_release/macos/cpu_py36.sh index 69a7f28a13a..041b9818b52 100644 --- a/tensorflow/tools/ci_build/nightly_release/macos/cpu_py36.sh +++ b/tensorflow/tools/ci_build/nightly_release/macos/cpu_py36.sh @@ -25,6 +25,8 @@ sudo xcode-select -s "${DEVELOPER_DIR}" install_macos_pip_deps sudo pip3.6 +sudo pip3.6 install 'twine ~= 3.2.0' + # For python3 path on Mac export PATH=$PATH:/usr/local/bin diff --git a/tensorflow/tools/ci_build/nightly_release/macos/cpu_py37.sh b/tensorflow/tools/ci_build/nightly_release/macos/cpu_py37.sh index 50ddbf0ba93..36e02518ad4 100644 --- a/tensorflow/tools/ci_build/nightly_release/macos/cpu_py37.sh +++ b/tensorflow/tools/ci_build/nightly_release/macos/cpu_py37.sh @@ -25,6 +25,8 @@ sudo xcode-select -s "${DEVELOPER_DIR}" install_macos_pip_deps sudo pip3.7 +sudo pip3.7 install 'twine ~= 3.2.0' + # For python3 path on Mac export PATH=$PATH:/usr/local/bin diff --git a/tensorflow/tools/ci_build/nightly_release/macos/cpu_py38.sh b/tensorflow/tools/ci_build/nightly_release/macos/cpu_py38.sh index 5d7e816ef32..cf095773614 100644 --- a/tensorflow/tools/ci_build/nightly_release/macos/cpu_py38.sh +++ b/tensorflow/tools/ci_build/nightly_release/macos/cpu_py38.sh @@ -25,6 +25,8 @@ sudo xcode-select -s "${DEVELOPER_DIR}" install_macos_pip_deps sudo pip3.8 +sudo pip3.8 install 'twine ~= 3.2.0' + # For python3 path on Mac export PATH=$PATH:/usr/local/bin diff --git a/tensorflow/tools/ci_build/presubmit/macos/py37_cc/build.sh b/tensorflow/tools/ci_build/presubmit/macos/py37_cc/build.sh index b6e224db6f3..7c55b43d61c 100644 --- a/tensorflow/tools/ci_build/presubmit/macos/py37_cc/build.sh +++ b/tensorflow/tools/ci_build/presubmit/macos/py37_cc/build.sh @@ -27,7 +27,7 @@ set -x function setup_pip () { python3.7 -m virtualenv tf_build_env --system-site-packages source tf_build_env/bin/activate - install_macos_pip_deps_virtualenv + install_macos_pip_deps virtualenv } function run_build () { diff --git a/tensorflow/tools/ci_build/release/common.sh b/tensorflow/tools/ci_build/release/common.sh index 067c7a89588..11b7c2abcb4 100644 --- a/tensorflow/tools/ci_build/release/common.sh +++ b/tensorflow/tools/ci_build/release/common.sh @@ -151,43 +151,13 @@ function install_ubuntu_16_pip_deps { "${PIP_CMD}" install --user 'PyYAML ~= 5.3.1' } -# TODO(amitpatankar): Move this function logic into install_macos_pip_deps. -function install_macos_pip_deps_virtualenv { - PIP_CMD="pip" - ${PIP_CMD} install --upgrade setuptools pip wheel - # Now, install the deps, as listed in setup.py - ${PIP_CMD} install 'absl-py ~= 0.10' - ${PIP_CMD} install 'astunparse ~= 1.6.3' - ${PIP_CMD} install 'flatbuffers ~= 1.12.0' - ${PIP_CMD} install 'google_pasta ~= 0.2' - ${PIP_CMD} install 'h5py ~= 2.10.0' - ${PIP_CMD} install 'keras_preprocessing ~= 1.1.2' - ${PIP_CMD} install 'numpy ~= 1.19.2' - ${PIP_CMD} install 'opt_einsum ~= 3.3.0' - ${PIP_CMD} install 'protobuf >= 3.9.2' - ${PIP_CMD} install 'six ~= 1.15.0' - ${PIP_CMD} install 'termcolor ~= 1.1.0' - ${PIP_CMD} install 'typing_extensions ~= 3.7.4' - ${PIP_CMD} install 'wheel ~= 0.35' - ${PIP_CMD} install 'wrapt ~= 1.12.1' - # We need to pin gast dependency exactly - ${PIP_CMD} install 'gast == 0.3.3' - # Finally, install tensorboard and estimator - # Note that here we want the latest version that matches (b/156523241) - ${PIP_CMD} install --upgrade --force-reinstall 'tb-nightly ~= 2.4.0.a' - ${PIP_CMD} install --upgrade --force-reinstall 'tensorflow_estimator ~= 2.3.0' - # Test dependencies - ${PIP_CMD} install 'grpcio ~= 1.32.0' - ${PIP_CMD} install 'portpicker ~= 1.3.1' - ${PIP_CMD} install 'scipy ~= 1.5.2' - ${PIP_CMD} install 'twine ~= 3.2.0' -} - function install_macos_pip_deps { # TODO(mihaimaruseac): Remove need for sudo, then this can be merged with # above (probably needs to convert to venv too). SUDO_CMD="" PIP_CMD="pip" + IS_VIRTUALENV=false + USER_FLAG="--user" while true; do if [[ -z "${1}" ]]; then @@ -200,6 +170,10 @@ function install_macos_pip_deps { SUDO_CMD="sudo -H " elif [[ "$1" == "pip"* ]]; then PIP_CMD="$1" + elif [[ "$1" == "virtualenv" ]]; then + IS_VIRTUALENV=true + PIP_CMD="pip" + USER_FLAG="" fi shift done @@ -208,33 +182,33 @@ function install_macos_pip_deps { # To have reproducible builds, these dependencies should be pinned always. # Prefer pinning to the same version as in setup.py # First, upgrade pypi wheels - ${PIP_CMD} install --user --upgrade setuptools pip wheel + ${PIP_CMD} install $USER_FLAG --upgrade setuptools pip wheel # Now, install the deps, as listed in setup.py - ${PIP_CMD} install --user 'absl-py ~= 0.10' - ${PIP_CMD} install --user 'astunparse ~= 1.6.3' - ${PIP_CMD} install --user 'flatbuffers ~= 1.12.0' - ${PIP_CMD} install --user 'google_pasta ~= 0.2' - ${PIP_CMD} install --user 'h5py ~= 2.10.0' - ${PIP_CMD} install --user 'keras_preprocessing ~= 1.1.2' - ${PIP_CMD} install --user 'numpy ~= 1.19.2' - ${PIP_CMD} install --user 'opt_einsum ~= 3.3.0' - ${PIP_CMD} install --user 'protobuf >= 3.9.2' - ${PIP_CMD} install --user 'six ~= 1.15.0' - ${PIP_CMD} install --user 'termcolor ~= 1.1.0' - ${PIP_CMD} install --user 'typing_extensions ~= 3.7.4' - ${PIP_CMD} install --user 'wheel ~= 0.35' - ${PIP_CMD} install --user 'wrapt ~= 1.12.1' + ${PIP_CMD} install $USER_FLAG 'absl-py ~= 0.10' + ${PIP_CMD} install $USER_FLAG 'astunparse ~= 1.6.3' + ${PIP_CMD} install $USER_FLAG 'flatbuffers ~= 1.12.0' + ${PIP_CMD} install $USER_FLAG 'google_pasta ~= 0.2' + ${PIP_CMD} install $USER_FLAG 'h5py ~= 2.10.0' + ${PIP_CMD} install $USER_FLAG 'keras_preprocessing ~= 1.1.2' + ${PIP_CMD} install $USER_FLAG 'numpy ~= 1.19.2' + ${PIP_CMD} install $USER_FLAG 'opt_einsum ~= 3.3.0' + ${PIP_CMD} install $USER_FLAG 'protobuf >= 3.9.2' + ${PIP_CMD} install $USER_FLAG 'six ~= 1.15.0' + ${PIP_CMD} install $USER_FLAG 'termcolor ~= 1.1.0' + ${PIP_CMD} install $USER_FLAG 'typing_extensions ~= 3.7.4' + ${PIP_CMD} install $USER_FLAG 'wheel ~= 0.35' + ${PIP_CMD} install $USER_FLAG 'wrapt ~= 1.12.1' # We need to pin gast dependency exactly - ${PIP_CMD} install --user 'gast == 0.3.3' + ${PIP_CMD} install $USER_FLAG 'gast == 0.3.3' # Finally, install tensorboard and estimator # Note that here we want the latest version that matches (b/156523241) - ${PIP_CMD} install --user --upgrade --force-reinstall 'tb-nightly ~= 2.4.0.a' - ${PIP_CMD} install --user --upgrade --force-reinstall 'tensorflow_estimator ~= 2.3.0' + ${PIP_CMD} install $USER_FLAG --upgrade --force-reinstall 'tb-nightly ~= 2.4.0.a' + ${PIP_CMD} install $USER_FLAG --upgrade --force-reinstall 'tensorflow_estimator ~= 2.3.0' # Test dependencies - ${PIP_CMD} install --user 'grpcio ~= 1.32.0' - ${PIP_CMD} install --user 'portpicker ~= 1.3.1' - ${PIP_CMD} install --user 'scipy ~= 1.5.2' - ${PIP_CMD} install --user 'twine ~= 3.2.0' + ${PIP_CMD} install $USER_FLAG 'grpcio ~= 1.32.0' + ${PIP_CMD} install $USER_FLAG 'portpicker ~= 1.3.1' + ${PIP_CMD} install $USER_FLAG 'scipy ~= 1.5.2' + # LINT.ThenChange(:linux_pip_installations) }