Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

upgrade tensorflow v2.5.0 and python3.9 #250

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ATTRIBUTIONS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Attributions

We include binary wheels of the following open source packages compiled for macOS 11.0:
We include binary wheels of the following open source packages compiled for macOS 11.3:

- NumPy: https://github.com/numpy/numpy
- SciPy: https://github.com/scipy/scipy
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2020 Apple Inc. All Rights Reserved.
Copyright (C) 2021 Apple Inc. All Rights Reserved.

IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ This pre-release delivers hardware-accelerated TensorFlow and TensorFlow Addons

### CURRENT RELEASE

- 0.1-alpha3
- 0.1-alpha4

### SUPPORTED VERSIONS

- TensorFlow r2.4rc0
- TensorFlow Addons 0.11.2
- TensorFlow r2.5.0
- TensorFlow Addons 0.12.1

### REQUIREMENTS

- macOS 11.0+
- Python 3.8 (required to be downloaded from [Xcode Command Line Tools](https://developer.apple.com/download/more/?=command%20line%20tools) for M1 Macs).
- Python 3.9 (required to be downloaded from [Xcode Command Line Tools](https://developer.apple.com/download/more/?=command%20line%20tools) for M1 Macs).

### INSTALLATION

Expand All @@ -29,7 +29,7 @@ An archive containing Python packages and an installation script can be download
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"
```

This will verify your system, ask you for confirmation, then create a [virtual environment](https://docs.python.org/3.8/tutorial/venv.html) with TensorFlow for macOS installed.
This will verify your system, ask you for confirmation, then create a [virtual environment](https://docs.python.org/3.9/tutorial/venv.html) with TensorFlow for macOS installed.

- Alternatively, download the archive file from the [releases](https://github.com/apple/tensorflow_macos/releases). The archive contains an installation script, accelerated versions of TensorFlow, TensorFlow Addons, and needed dependencies.

Expand All @@ -54,7 +54,7 @@ For M1 Macs, the following packages are currently unavailable:
When installing pip packages in a virtual environment, you may need to specify `--target` as follows:

```
% pip install --upgrade -t "${VIRTUAL_ENV}/lib/python3.8/site-packages/" PACKAGE_NAME
% pip install --upgrade -t "${VIRTUAL_ENV}/lib/python3.9/site-packages/" PACKAGE_NAME
```

### ISSUES AND FEEDBACK
Expand Down
7 changes: 7 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Release 0.1-alpha4

* Python 3.9 native in Big Sur
* Tensorflow v2.5.0rc2
* Packages updated to Tensorflow compatible


# Release 0.1-alpha3

* Fixes several failures in TensorFlow unit tests and other bug fixes.
Expand Down
4 changes: 2 additions & 2 deletions scripts/download_and_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

VERSION=0.1alpha3
VERSION=0.1alpha4
INSTALLER_PACKAGE=tensorflow_macos-$VERSION.tar.gz
INSTALLER_PATH=https://github.com/apple/tensorflow_macos/releases/download/v$VERSION/$INSTALLER_PACKAGE
INSTALLER_SCRIPT=install_venv.sh
Expand All @@ -20,7 +20,7 @@ echo "Installation script for pre-release tensorflow_macos $VERSION. Please vis
echo "for instructions and license information."
echo
echo "This script will download tensorflow_macos $VERSION and needed binary dependencies, then install them into a new "
echo "or existing Python 3.8 virtual environment."
echo "or existing Python 3.9 virtual environment."

# Make sure the user knows what's going on.
read -p 'Continue [y/N]? '
Expand Down
44 changes: 22 additions & 22 deletions scripts/install_venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@

set -e

arch_list_x86_64=( numpy-1.18.5-cp38-cp38-macosx_11_0_x86_64.whl
grpcio-1.33.2-cp38-cp38-macosx_11_0_x86_64.whl
h5py-2.10.0-cp38-cp38-macosx_11_0_x86_64.whl
scipy-1.5.4-cp38-cp38-macosx_11_0_x86_64.whl )
arch_list_x86_64=( numpy-1.19.5-cp39-cp39-macosx_11_0_x86_64.whl
grpcio-1.34.1-cp39-cp39-macosx_11_0_x86_64.whl
h5py-3.1.0-cp39-cp39-macosx_11_0_x86_64.whl
scipy-1.6.1-cp39-cp39-macosx_11_0_x86_64.whl )

arch_list_arm64=( numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl
grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl
h5py-2.10.0-cp38-cp38-macosx_11_0_arm64.whl )
arch_list_arm64=( numpy-1.19.5-cp39-cp39-macosx_11_0_arm64.whl
grpcio-1.34.1-cp39-cp39-macosx_11_0_arm64.whl
h5py-3.1.0-cp39-cp39-macosx_11_0_arm64.whl )


tensorflow_version=0.1a3
tensorflow_version=0.1a4


function usage() {
Expand Down Expand Up @@ -182,15 +182,15 @@ tf_install_message=""
# Now, see if a virtual environment was given as an argument.
if [[ -e $virtual_env ]] ; then
if [[ ! -d "$virtual_env" ]] || [[ ! -e "$virtual_env/bin/python" ]] ; then
error_exit "$virtual_env does not seem to be a virtual environment. Please specify a new directory or an existing Python 3.8 virtual environment. "
error_exit "$virtual_env does not seem to be a virtual environment. Please specify a new directory or an existing Python 3.9 virtual environment. "
fi
create_venv=0

python_bin="$virtual_env/bin/python"

# Check: Make sure the python version is correct.
if [[ $("$python_bin" --version) != *"3.8"* ]] ; then
error_exit "Python version in specificed virtual environment $virtual_env not 3.8. Python 3.8 required for tensorflow_macos $tensorflow_version."
if [[ $("$python_bin" --version) != *"3.9"* ]] ; then
error_exit "Python version in specificed virtual environment $virtual_env not 3.9. Python 3.9 required for tensorflow_macos $tensorflow_version."
fi

if [[ ! -z $python_path_opt ]] && [[ ! "$python_path_opt" -ef "$python_bin" ]] ; then
Expand All @@ -199,7 +199,7 @@ if [[ -e $virtual_env ]] ; then

# Finally, check if tensorflow is currently installed.

if ls "$virtual_env"/lib/python3.8/site-packages/tensorflow-*.dist-info 1> /dev/null 2>&1; then
if ls "$virtual_env"/lib/python3.9/site-packages/tensorflow-*.dist-info 1> /dev/null 2>&1; then
uninstall_tf=1
print_messages+=( " -> Uninstall existing tensorflow installation." )
fi
Expand All @@ -210,7 +210,7 @@ else

uninstall_tf=0
create_venv=1
print_messages+=( " -> Create new python 3.8 virtual environment at $virtual_env."
print_messages+=( " -> Create new python 3.9 virtual environment at $virtual_env."
" -> Install tensorflow_macos $tensorflow_version into created virtual environment $virtual_env." )

if [[ ! -z $python_path_opt ]] ; then
Expand All @@ -228,13 +228,13 @@ else

# Check: python bin executable
if [[ ! -e $python_bin ]] ; then
error_exit "No suitable Python executable found in path. Please specify a Python 3.8 executable with the --python option."
error_exit "No suitable Python executable found in path. Please specify a Python 3.9 executable with the --python option."
fi
fi

# Check: Make sure the python version is correct.
if [[ $($python_bin --version) != *"3.8"* ]] ; then
error_exit "Error retrieving python version, or python executable $python_bin not version 3.8. Please specify a Python 3.8 executable with the --python option."
if [[ $($python_bin --version) != *"3.9"* ]] ; then
error_exit "Error retrieving python version, or python executable $python_bin not version 3.9. Please specify a Python 3.9 executable with the --python option."
else
echo "Using python from $python_bin."
fi
Expand Down Expand Up @@ -267,7 +267,7 @@ if [[ $no_dependencies_opt == 0 ]] ; then
s=" -> Install bundled binary wheels for "

for p in "${packages[@]}" ; do
s="$s ${p%%-cp38*whl}, "
s="$s ${p%%-cp39*whl}, "
done

s="${s%%, } into $virtual_env."
Expand Down Expand Up @@ -321,13 +321,13 @@ fi

# Upgrade pip and base packages
echo ">> Installing and upgrading base packages."
"$python_bin" -m pip install --force pip==20.2.4 wheel setuptools cached-property six packaging
"$python_bin" -m pip install --force pip==21.1.1 wheel setuptools cached-property six packaging

echo ">> Installing bundled binary dependencies."

# Note: As soon python packaging supports macOS 11.0 in full, we can remove the -t hackery.
for f in ${packages[@]} ; do
"$python_bin" -m pip install --upgrade -t "$virtual_env/lib/python3.8/site-packages/" --no-dependencies --force "$package_dir/$f"
"$python_bin" -m pip install --upgrade -t "$virtual_env/lib/python3.9/site-packages/" --no-dependencies --force "$package_dir/$f"
done

# Manually install all the other dependencies.
Expand All @@ -338,17 +338,17 @@ echo ">> Installing dependencies."
"$python_bin" -m pip install ipython

# Install the tensorflow wheel itself.
"$python_bin" -m pip install --upgrade --force -t "$virtual_env/lib/python3.8/site-packages/" --no-dependencies "$package_dir"/tensorflow_macos*-cp38-cp38-macosx_11_0_$arch.whl
"$python_bin" -m pip install --upgrade --force -t "$virtual_env/lib/python3.9/site-packages/" --no-dependencies "$package_dir"/tensorflow_macos*-cp39-cp39-macosx_11_0_$arch.whl

# Install the tensorflow-addons wheel.
"$python_bin" -m pip install --upgrade --force -t "$virtual_env/lib/python3.8/site-packages/" --no-dependencies "$package_dir"/tensorflow_addons_macos*-cp38-cp38-macosx_11_0_$arch.whl
"$python_bin" -m pip install --upgrade --force -t "$virtual_env/lib/python3.9/site-packages/" --no-dependencies "$package_dir"/tensorflow_addons_macos*-cp39-cp39-macosx_11_0_$arch.whl

# Finally, upgrade pip to give the developers the correct version.
"$python_bin" -m pip install --upgrade pip

echo '###########################################################################'
echo
echo "TensorFlow and TensorFlow Addons with ML Compute for macOS 11.0 successfully installed."
echo "TensorFlow and TensorFlow Addons with ML Compute for macOS 11.3 successfully installed."
echo

if [[ -e "$virtual_env/bin/activate" ]] ; then
Expand Down