diff --git a/oss_scripts/configure.sh b/oss_scripts/configure.sh index e450c3401..6569dfc50 100755 --- a/oss_scripts/configure.sh +++ b/oss_scripts/configure.sh @@ -37,11 +37,22 @@ function is_macos() { # Remove .bazelrc if it already exist [ -e .bazelrc ] && rm .bazelrc -if [[ $(pip show tensorflow) == *tensorflow* ]] || [[ $(pip show tf-nightly) == *tf-nightly* ]] ; then +if [[ $(pip show tensorflow) == *tensorflow* ]] || + [[ $(pip show tensorflow-macos) == *tensorflow-macos* ]] || + [[ $(pip show tf-nightly) == *tf-nightly* ]]; then echo 'Using installed tensorflow.' else echo 'Installing tensorflow.' - pip install tensorflow==2.7.0 + if is_macos; then + # Only Apple Silicon will be installed with tensorflow-macos. + if [[ x"$(arch)" == x"arm64" ]]; then + pip install tensorflow-macos==2.6.0 + else + pip install tensorflow==2.7.0 + fi + else + pip install tensorflow==2.7.0 + fi fi if is_windows; then diff --git a/oss_scripts/pip_package/build_pip_package.sh b/oss_scripts/pip_package/build_pip_package.sh index 1e5470c25..f91d79dbe 100755 --- a/oss_scripts/pip_package/build_pip_package.sh +++ b/oss_scripts/pip_package/build_pip_package.sh @@ -39,7 +39,11 @@ function abspath() { plat_name="" if is_macos; then - plat_name="--plat-name macosx-10.9-x86_64" + if [[ x"$(arch)" == x"arm64" ]]; then + plat_name="--plat-name macosx_11_0_arm64" + else + plat_name="--plat-name macosx-10.9-x86_64" + fi fi main() { diff --git a/oss_scripts/pip_package/setup.py b/oss_scripts/pip_package/setup.py index 1dc3f61d8..faf8b1298 100644 --- a/oss_scripts/pip_package/setup.py +++ b/oss_scripts/pip_package/setup.py @@ -73,7 +73,6 @@ def finalize_options(self): cmdclass={'install': InstallPlatlib}, distclass=BinaryDistribution, install_requires=[ - 'tensorflow>=2.7.0, <2.8', 'tensorflow_hub>=0.8.0', ], extras_require={