tensorflow/addons

tensorflow-addons doesn't work with tensorflow-macos

atn832 opened this issue ยท 14 comments

Describe the feature and the current behavior/state.
On my Mac with M1, on which TensorFlow 2.5 for Mac is installed, pip install tensorflow-addons fails with this error:

% pip install tensorflow-addons
ERROR: Could not find a version that satisfies the requirement tensorflow-addons (from versions: none)
ERROR: No matching distribution found for tensorflow-addons

Here's the output of pip list:

% pip list
Package                 Version
----------------------- -------------------
...
tensorboard-plugin-wit  1.8.0
tensorflow-estimator    2.5.0
tensorflow-macos        2.5.0 <--
tensorflow-metal        0.1.1
termcolor               1.1.0
...

Relevant information

  • Are you willing to contribute it (yes/no): maybe
    If you wish to contribute, then read the requirements for new contributions in CONTRIBUTING.md
  • Are you willing to maintain it going forward? (yes/no):
  • Is there a relevant academic paper? (if so, where): no
  • Does the relavent academic paper exceed 50 citations? (yes/no): n/a
  • Is there already an implementation in another framework? (if so, where):
  • Was it part of tf.contrib? (if so, where): setup.py

Who will benefit with this feature?
Users of TensorFlow for Mac.

Any other info.

Can you use this compilation?
https://github.com/apple/tensorflow_macos

Otherwise you may need to build from source in order to use custom ops. Python ops should work fine (since custom ops are lazily loaded) but you may need to download the whl yourself in order to install

same issue

The attached patch enables source build on M1 Mac.
I hope that this fix will be reflected in the original source code.

addons.patch.txt

Please review the pull request.

#2504

bhack commented

@Liu-Da Can you test that PR on your M1?

Yes, I did. The steps are as follows.

create python virtual environment

(I installed python 3.9.5 with pyenv and pyenv-virtualenv.)

install tensorflow

pip install tensorflow-macos
pip install tensorflow-metal

install bazel 3.7.2

xcode-select --install || echo OK
export BAZEL_VERSION=3.7.2
curl -fLO "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh"
chmod +x "bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh"
./bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh --user
(set the PATH to bazel)

install tensorflow-addons

git clone -b mywork https://github.com/tetsuyasu/addons.git/
cd addons
python3 ./configure.py
bazel build build_pip_pkg
pip install pathlib
bazel-bin/build_pip_pkg artifacts
pip install artifacts/tensorflow_addons-*.whl

(sorry if this is not the space for this question) How can I use this solution to install tensorFlow-addons into a Conda environment under macOS M1?

Instructions to install TensorFlow in a Conda Environment #153
apple/tensorflow_macos#153

bhack commented

It would be nice if you can add something in the Readme.md

I installed it using pip in console but with my environment activated.

Zahlii commented

Is there any update/current status here? This is still an issue in 2023, and a blocking one for my current development on my new M1/M2 MacBook.

Also an issue for me. I receive an error when trying to install tensorflow-addons on Docker ubuntu image (running in M1):

Unable to find installation candidates for tensorflow-addons (0.17.1)

Same here.

Unable to find installation candidates for tensorflow-addons (0.21.0)