diff options
author | Shanqing Cai <cais@google.com> | 2016-07-11 10:55:21 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-07-11 12:01:57 -0700 |
commit | b2bf45a0b91403fa00c0b35480e69d26eb8ce58d (patch) | |
tree | 674793b9151314fd9df6519f362f009b2abf4fdc | |
parent | 8780cb605ffc896ade2e9dc8c79a34b3cce85265 (diff) |
Namei wheel file properly to avoid name changes and pip install issues
On Linux, we have seen the whl files built from the PIP tensorflow builds change their names for unclear reasons, leading to the need to update README.md and install issues like these:
https://github.com/tensorflow/tensorflow/issues/1097
http://stackoverflow.com/questions/33622613/tensorflow-installation-error-not-a-supported-wheel-on-this-platform
as well as build issues like:
http://ci.tensorflow.org/view/Nightly/job/nightly-distributed-build-server/132/console
This CL aims to freeze the whl file naming pattern on Linux to prevent such issues from happening in the future.
Change: 127111314
-rwxr-xr-x | tensorflow/tools/ci_build/builds/pip.sh | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/tensorflow/tools/ci_build/builds/pip.sh b/tensorflow/tools/ci_build/builds/pip.sh index 122a3c6dc5..e1820da4a1 100755 --- a/tensorflow/tools/ci_build/builds/pip.sh +++ b/tensorflow/tools/ci_build/builds/pip.sh @@ -49,6 +49,12 @@ # to run. # +# Constants: +# Fixed naming patterns for wheel (.whl) files given different python versions +declare -A WHL_TAGS +WHL_TAGS=(["2.7"]="cp27-none" ["3.4"]="cp34-cp34m" ["3.5"]="cp35-cp35m") + + INSTALL_EXTRA_PIP_PACKAGES=${TF_BUILD_INSTALL_EXTRA_PIP_PACKAGES} @@ -128,10 +134,14 @@ fi # This info will be useful for determining the directory of the local pip # installation of Python PY_MAJOR_MINOR_VER=$(${PYTHON_BIN_PATH} -V 2>&1 | awk '{print $NF}' | cut -d. -f-2) +if [[ -z "${PY_MAJOR_MINOR_VER}" ]]; then + die "ERROR: Unable to determine the major.minor version of Python" +fi echo "Python binary path to be used in PIP install: ${PYTHON_BIN_PATH} "\ "(Major.Minor version: ${PY_MAJOR_MINOR_VER})" + # Build PIP Wheel file PIP_TEST_ROOT="pip_test" PIP_WHL_DIR="${PIP_TEST_ROOT}/whl" @@ -140,16 +150,35 @@ rm -rf ${PIP_WHL_DIR} && mkdir -p ${PIP_WHL_DIR} bazel-bin/tensorflow/tools/pip_package/build_pip_package ${PIP_WHL_DIR} || \ die "build_pip_package FAILED" -# Perform installation WHL_PATH=$(ls ${PIP_WHL_DIR}/tensorflow*.whl) if [[ $(echo ${WHL_PATH} | wc -w) -ne 1 ]]; then die "ERROR: Failed to find exactly one built TensorFlow .whl file in "\ "directory: ${PIP_WHL_DIR}" fi +# If on Linux, rename the whl file properly so it will have the python +# version tags and platform tags that won't cause pip install issues. +if [[ $(uname) == "Linux" ]]; then + PY_TAGS=${WHL_TAGS[${PY_MAJOR_MINOR_VER}]} + + if [[ ! -z "${PY_TAGS}" ]]; then + PLATFORM_TAG=$(to_lower "$(uname)_$(uname -m)") + WHL_DIR=$(dirname "${WHL_PATH}") + WHL_BASE_NAME=$(basename "${WHL_PATH}") + + NEW_WHL_BASE_NAME=$(echo ${WHL_BASE_NAME} | cut -d \- -f 1)-\ +$(echo ${WHL_BASE_NAME} | cut -d \- -f 2)-${PY_TAGS}-${PLATFORM_TAG}.whl + + cp "${WHL_DIR}/${WHL_BASE_NAME}" "${WHL_DIR}/${NEW_WHL_BASE_NAME}" && \ + echo "Copied wheel file: ${WHL_BASE_NAME} --> ${NEW_WHL_BASE_NAME}" || \ + die "ERROR: Failed to copy wheel file to ${NEW_WHL_BASE_NAME}" + fi +fi + echo "whl file path = ${WHL_PATH}" -# Install, in user's local home folder + +# Perform installation echo "Installing pip whl file: ${WHL_PATH}" # Create virtualenv directory for install test |