Skip to content

Commit 596b2c8

Browse files
committed
Restrict some dependencies temporarily.
PiperOrigin-RevId: 615039730
1 parent d31c6b3 commit 596b2c8

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

build_common.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,29 @@ function install_tensorflow() {
2020
# Install tensorflow from pip.
2121
#
2222
# Usage: install_tensorflow NIGHTLY_TF|NIGHTLY_TF_2|RELEASED_TF|PRERELEASED_TF|RELEASED_TF_2|PRERELEASED_TF_2 /PATH/TO/PIP /PATH/TO/PYTHON
23+
24+
#TODO(b/329181965): As TFX lags for TensorFlow version, let's pass
25+
#the ceiling TF Version to the installation script.
26+
TF_MAX_VERSION = $4
27+
2328
if [[ ("$1" == NIGHTLY_TF) || ("$1" == NIGHTLY_TF_2) ]]; then
2429
TF_PIP_PACKAGE="tf-nightly"
2530
elif [[ "$1" == RELEASED_TF ]]; then
2631
TF_PIP_PACKAGE="tensorflow<2"
2732
elif [[ "$1" == PRERELEASED_TF ]]; then
2833
TF_PIP_PACKAGE="tensorflow<2"
2934
elif [[ "$1" == RELEASED_TF_2 ]]; then
30-
TF_PIP_PACKAGE="tensorflow>=2"
35+
if [[ -z "$TF_MAX_VERSION" ]]; then
36+
TF_PIP_PACKAGE="tensorflow>=2,<3"
37+
else
38+
TF_PIP_PACKAGE="tensorflow>=2,<${TF_MAX_VERSION}"
39+
fi
3140
elif [[ "$1" == PRERELEASED_TF_2 ]]; then
32-
TF_PIP_PACKAGE="tensorflow>=2"
41+
if [[ -z "$TF_MAX_VERSION" ]]; then
42+
TF_PIP_PACKAGE="tensorflow>=2,<3"
43+
else
44+
TF_PIP_PACKAGE="tensorflow>=2,<${TF_MAX_VERSION}"
45+
fi
3346
else
3447
echo "Invalid tensorflow version string must be one of NIGHTLY_TF, NIGHTLY_TF_2, RELEASED_TF, PRERELEASED_TF, RELEASED_TF_2, PRERELEASED_TF_2."
3548
exit 1
@@ -69,6 +82,10 @@ for i in "$@"; do
6982
shift # past argument=value
7083
SKIP_STATIC_LINK_TEST=1
7184
;;
85+
--tf_max_version=*)
86+
shift # past argument=value
87+
TF_MAX_VERSION=${i#*=}
88+
;;
7289
*)
7390
printf "Unrecognized argument $1"
7491
exit 1
@@ -78,7 +95,7 @@ done
7895

7996
set -x
8097

81-
install_tensorflow ${TF_VERSION} ${PIP_BIN_PATH} ${PYTHON_BIN_PATH}
98+
install_tensorflow ${TF_VERSION} ${PIP_BIN_PATH} ${PYTHON_BIN_PATH} ${TF_MAX_VERSION}
8299
./configure.sh --python_bin_path "${PYTHON_BIN_PATH}"
83100

84101
if [[ ("${TF_VERSION}" == "NIGHTLY_TF") || ("${TF_VERSION}" == "NIGHTLY_TF_2") ]]; then

struct2tensor/tools/docker_build/build_manylinux.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ function bazel_build() {
4646
if [[ -n ${SKIP_STATIC_LINK_TEST} ]]; then
4747
build_args+=("--skip_static_link_test")
4848
fi
49+
50+
# TODO(b/329181965): TFX requires to install tensorflow<2.16,
51+
# as it is not migrated yet.
52+
if [[ -n ${TF_MAX_VERSION} ]]; then
53+
build_args+=("--tf_max_version=${TF_MAX_VERSION}")
54+
fi
55+
4956
./build_common.sh "${build_args[@]}"
5057
}
5158

0 commit comments

Comments
 (0)