Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensorflow-addons doesn't work with tensorflow-macos #2503

Closed
atn832 opened this issue Jun 15, 2021 · 11 comments · Fixed by #2504 or #2559
Closed

tensorflow-addons doesn't work with tensorflow-macos #2503

atn832 opened this issue Jun 15, 2021 · 11 comments · Fixed by #2504 or #2559

Comments

@atn832
Copy link

@atn832 atn832 commented Jun 15, 2021

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.

@seanpmorgan
Copy link
Member

@seanpmorgan seanpmorgan commented Jun 15, 2021

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

@Liu-Da
Copy link

@Liu-Da Liu-Da commented Jun 15, 2021

same issue

@tetsuyasu
Copy link
Contributor

@tetsuyasu tetsuyasu commented Jun 16, 2021

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

@tetsuyasu tetsuyasu mentioned this issue Jun 16, 2021
21 tasks
@tetsuyasu
Copy link
Contributor

@tetsuyasu tetsuyasu commented Jun 17, 2021

Please review the pull request.

#2504

@bhack
Copy link
Contributor

@bhack bhack commented Jun 17, 2021

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

@tetsuyasu
Copy link
Contributor

@tetsuyasu tetsuyasu commented Jun 17, 2021

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

@tetsuyasu
Copy link
Contributor

@tetsuyasu tetsuyasu commented Jun 17, 2021

This is a sample build for Python3.9.

tensorflow_addons-0.14.0.dev0-cp39-cp39-macosx_11_0_arm64.zip

@MR-T77
Copy link

@MR-T77 MR-T77 commented Aug 25, 2021

(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?

@tetsuyasu
Copy link
Contributor

@tetsuyasu tetsuyasu commented Aug 26, 2021

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

@bhack
Copy link
Contributor

@bhack bhack commented Aug 26, 2021

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

@JASC-droid
Copy link

@JASC-droid JASC-droid commented Mar 28, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants