-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Mac M1 Tensorflow Set Up #1514
Comments
MediaPipe with its TensorFlow dependence needs Bazel to build everything from scratch. I don't think bazel already supports M1 yet: bazelbuild/bazel#11628. https://github.com/apple/tensorflow_macos requires the users to use https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha1/tensorflow_macos-0.1alpha1.tar.gz, which is not the "official" version of tensorflow. |
It looks like the tensorflow team has added M1 support. tensorflow/tensorflow#46178 Is there a workaround to not have to wait for bazel compatibility? |
I took a look at tensorflow/tensorflow@e687cab. My conclusion is the mediapipe repo needs some config changes for supporting Apple Silicon. For example, the repo needs to add a config for "macos_arm64" config_setting like the one it has for macos_x86_64. Also, it needs to point to the latest TF version that supports Apple Silicon. |
Do you have an ETA when the repo will be updated with the config changes? This blocks any integration from the m1 chip |
Any update on M1 support? |
also have an error on m1 |
Feels like barely anyone else has an M1 mac, has anyone got a fix for this? |
I am on M1 and its failing to build still |
Yea, not yet I suppose, I cannot install nuget too as it requires x86_64 architecture, I just use windows for now and my friend works on intel macbook |
I confirmed that diff --git a/.bazelrc b/.bazelrc
index 37a0bc1..7d7e159 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -87,6 +87,11 @@ build:darwin_x86_64 --apple_platform_type=macos
build:darwin_x86_64 --macos_minimum_os=10.12
build:darwin_x86_64 --cpu=darwin_x86_64
+# May not be necessary
+build:darwin_arm64 --apple_platform_type=macos
+build:darwin_arm64 --macos_minimum_os=10.16
+build:darwin_arm64 --cpu=darwin_arm64
+
# This bazelrc file is meant to be written by a setup script.
try-import %workspace%/.configure.bazelrc
diff --git a/.bazelversion b/.bazelversion
index 0b2eb36..fae6e3d 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-3.7.2
+4.2.1
diff --git a/WORKSPACE b/WORKSPACE
index c2aaca6..30afd92 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -200,7 +200,7 @@ new_local_repository(
new_local_repository(
name = "macos_opencv",
build_file = "@//third_party:opencv_macos.BUILD",
- path = "/usr/local/opt/opencv@3",
+ path = "/opt/homebrew/opt/opencv@3",
)
new_local_repository(
diff --git a/mediapipe/BUILD b/mediapipe/BUILD
index 1171ea6..72e4208 100644
--- a/mediapipe/BUILD
+++ b/mediapipe/BUILD
@@ -74,6 +74,7 @@ alias(
name = "macos",
actual = select({
":macos_i386": ":macos_i386",
+ ":macos_arm64": ":macos_arm64",
":macos_x86_64": ":macos_x86_64",
"//conditions:default": ":macos_i386", # Arbitrarily chosen from above.
}),
@@ -110,6 +111,15 @@ config_setting(
visibility = ["//visibility:public"],
)
+config_setting(
+ name = "macos_arm64",
+ values = {
+ "apple_platform_type": "macos",
+ "cpu": "darwin_arm64",
+ },
+ visibility = ["//visibility:public"],
+)
+
config_setting(
name = "macos_x86_64",
values = { The exact command can be found here. It seems that a similar patch is already submitted as a PR. |
@homuler Thank you for the recommendations; I've made those changes and I'm still having issues. Additionally, the PR you linked has issues: It still references bazel 3.7.2. Additionally in your changes, I had to also change the reference to ffmpeg in WORKSPACE. I installed the latest bazel (4.2.2) through brew, then updated .bazelversion to reflect that, but when I tried to run the helloworld, I ended up with: "dyld[70906]: symbol not found in flat namespace '_CFRelease'" Any further advice? |
It has been almost a year does anyone have a solution to this? I followed the changes in https://github.com/google/mediapipe/pull/2591/files with slight differences in OpenCV and FFMPEG versions and still got build errors.
I would prefer not to use a unity plugin. |
This doesn't solve the issue of running mediapipe on M1 metal, but you can get mediapipe to run on your M1 hardware by using rosetta, as described in this comment. (Read the rest of the comments before diving in. To solve the homebrew permissions problem in |
same problem here。 any solutions? |
I wonder why they don't reflect any of this limitation on the installation page at the TensorFlow website. They just say this:
Which seems to contradict the actual status if I'm following. What do you think? |
related: #3277 (community M1 wheels) |
Hi @mgebhard , |
Hi @sureshdagooglecom just so you know what I mentioned is just a workaround and is not a pull request or anything to fix it mainline. I don't think this issue is resolved. |
Closing as stale. Please reopen if you'd like to work on this further. |
I was able to install However, when I try to |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you. |
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you. |
This issue was closed due to lack of activity after being marked stale for past 7 days. |
"ERROR: While resolving toolchains for target @org_tensorflow//tensorflow/tools/git:gen_git_source: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See bazelbuild/bazel#10134 for details and migration instructions.
ERROR: Analysis of target '//mediapipe/examples/ios/facedetectioncpu:facedetectioncpu' failed; build aborted: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See bazelbuild/bazel#10134 for details and migration instructions."
I am trying to follow instructions here to set up tensorflow using the new mac m1 chip: https://github.com/apple/tensorflow_macos
However, I am still having no luck with initial set up for media pipe.
Have I written custom code: No
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Mac OS 11.0.1
Bazel version:nbazel 3.7.2-homebrew
Xcode & Tulsi version (if issue is related to building in mobile dev enviroment): 12.3 Tusli 0.20210106.88
Exact steps to reproduce: ./build_ios_examples.sh -d out_dir --nostrip
The text was updated successfully, but these errors were encountered: