flutter_tflite
flutter_tflite copied to clipboard
IOS Xcode Build error : 'metal_delegate.h' file not found
'metal_delegate.h' file not found error occurred when building with XCode.
Same issue with the latest version, when trying to build the application in XCode I just get .../tflite-1.1.1/ios/Classes/TflitePlugin.mm:21:9: 'metal_delegate.h' file not found
What's the version of TensorFlowLiteC? The plugin is tested with TensorFlowLiteC (2.2.0). Can you open the project in XCode, then go to Pods > TensorFlowLiteC > Frameworks > TensorFlowLiteC.framework > Headers and see if it contains metal_delegate.h?
Thanks, Qian
Hi, Thanks a lot I have same problem. There is no metal_delegate.h file.
Do you have any solution for it?
![스크린샷 2020-08-03 오후 6 06 37](https://user-images.githubusercontent.com/1106286/89165904-33510a00-d5b4-11ea-9505-f30b0d766859.png)
Downgrading TensorFlowLiteC to 2.2.0 worked for me
- Downgrade your TensorFlowLiteC in /ios/Podfile.lock to 2.2.0
- run
pod install
in your /ios folder
Downgrading TensorFlowLiteC to 2.2.0 worked for me
- Downgrade your TensorFlowLiteC in /ios/Podfile.lock to 2.2.0
- run
pod install
in your /ios folder
This also worked for me. Looks like the GPU delegate is no longer included in the pod from 2.3.0 on: https://www.tensorflow.org/lite/performance/gpu#step_2_modify_the_podfile_to_use_the_tensorflow_lite_gpu_cocoapod
Thanks downgrading to 2.2.0 worked. @shaqian tensorflow version in Podfile.lock was 2.3.0.
After downgrading. Its working well. Thanks a lot! 👍
Thanks every one, its working downgrade to 2.2.0 for me
If I downgrade in the Podfile.lock to 2.2.0 it tells me that tflite 1.1.1 depends on 2.3.0 and it fails to run pod install.
@JoseGeorges8 try flutter clean & flutter pub get first then do a pod install. My Podfile.lock looks like this:
- TensorFlowLiteC (2.2.0)
- tflite (1.1.1):
- Flutter
- TensorFlowLiteC
If we are running CI/CD pipeline, we should not make changes respective to podfile.lock one. So, is there any alternative ?
@Harshdeep4295 you can download the plugin and use it locally, make the changes in the tflite.podspec file instead of podfile.lock
@mirrorlink The thing is I can do that locally, but in case of any CI/CD pipeline, we need to write some script for it.
@Harshdeep4295 But I mean downloading the whole plugin. So the pipeline should use a local instance of the plugin instead of the github repository. Cant the CI/CD pipeline do that? I usually make the building scripts myself in node instead of using tools
ummm actually it can work, but i haven't tried it yet.
On Fri, 26 Feb, 2021, 23:58 mirrorlink, [email protected] wrote:
@Harshdeep4295 https://github.com/Harshdeep4295 But I mean downloading the whole plugin. So the pipeline should use a local instance of the plugin instead of the github repository. Cant the CI/CD pipeline do that? I usually make the building scripts myself in node instead of using tools
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shaqian/flutter_tflite/issues/139#issuecomment-786818166, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGETABICG6BZUIMDGLJVFJDTA7R6PANCNFSM4PNHHWKQ .
It works, im doing exactly that :D the downside is that you end up with a version of the plugin that needs to be updated manually
Cool... I'll try this though..
On Sat, 27 Feb, 2021, 00:42 mirrorlink, [email protected] wrote:
It works, im doing exactly that :D
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shaqian/flutter_tflite/issues/139#issuecomment-786840461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGETABIAJWIBOFZH2NZOT23TA7XBDANCNFSM4PNHHWKQ .
I'm running into the same problem. I tried several ways to downgrade to TensorflowLiteC 2.2.0. I did a flutter clean, a flutter pub get and a pod install but it always throws errors. This is what I have originally in my podfile.lock:
- TensorFlowLiteC (2.3.0):
- TensorFlowLiteC/Core (= 2.3.0)
- TensorFlowLiteC/Core (2.3.0)
- TensorFlowLiteObjC (2.3.0):
- TensorFlowLiteC (= 2.3.0)
- tflite (1.1.1):
- Flutter
- TensorFlowLiteC
How should this look like?
@JoergPf This is how my Podfile.lock, application is working on iOS
- TensorFlowLiteC (2.2.0)
- tflite (1.1.1):
- Flutter
- TensorFlowLiteC
Note I do not run my build in a pipeline.
See, if you are building via pipeline you have to add a script to change the TensorFlowLite after flutter pub get to change the version TensorFlowLite for pod install. If not building and working on the local system you can change things manually in the Podflie.lock file @JoergPf
Thanks for the quick replies.
- TensorFlowLiteC (2.2.0) - tflite (1.1.1): - Flutter - TensorFlowLiteC
This throws me an error unfortunately.
I tried these possibilities (showing also the packages before and after the TensorFlowLite section):
....
- PromisesObjC (1.2.12)
- Protobuf (3.14.0)
- TensorFlowLiteC (2.2.0)
- tflite (1.1.1):
- Flutter
- TensorFlowLiteC
- tflite (1.1.1):
- video_player (0.0.1):
- Flutter
This gives me a parsing error when running pod install.
I also tried ...
- PromisesObjC (1.2.12)
- Protobuf (3.14.0)
- TensorFlowLiteC (2.2.0)
- tflite (1.1.1):
- Flutter
- TensorFlowLiteC
- video_player (0.0.1):
- Flutter
This gives me the error
"ICocoaPods could not find compatible versions for pod "TensorFlowLiteObjC":
In snapshot (Podfile.lock):
TensorFlowLiteObjC (= 2.2.0, ~> 2.3.0)
In Podfile:
firebase_ml_custom (from `.symlinks/plugins/firebase_ml_custom/ios`) was resolved to 0.0.1, which depends on
Firebase/MLModelInterpreter (= 6.33.0) was resolved to 6.33.0, which depends on
FirebaseMLModelInterpreter (~> 0.22.0) was resolved to 0.22.0, which depends on
TensorFlowLiteObjC (~> 2.3.0)
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* changed the constraints of dependency `TensorFlowLiteObjC` inside your development pod `firebase_ml_custom`.
You should run `pod update TensorFlowLiteObjC` to apply changes you've made."
I did a pod repo update but get the same result.
And I tried to set TensorFlowLiteC in my original Podfile.lock to 2.2.0
- PromisesObjC (1.2.12)
- Protobuf (3.14.0)
- TensorFlowLiteC (2.2.0):
- TensorFlowLiteC/Core (= 2.2.0)
- TensorFlowLiteC/Core (2.2.0)
- TensorFlowLiteObjC (2.2.0):
- TensorFlowLiteC (= 2.2.0)
- tflite (1.1.1):
- Flutter
- TensorFlowLiteC
- video_player (0.0.1):
- Flutter
I'm getting the same error:
"CocoaPods could not find compatible versions for pod "TensorFlowLiteObjC":
In snapshot (Podfile.lock):
TensorFlowLiteObjC (= 2.2.0, ~> 2.3.0) .... "
I'm still new to flutter and I think I'm not building via pipeline if you mean CICD workflows. We are trying CICD in a different test project but now in this one.
Did you try do a pod install --repo-update
?
I just did a pod install --repo-update
and get the same error:
"[!] CocoaPods could not find compatible versions for pod "TensorFlowLiteC":
In snapshot (Podfile.lock):
TensorFlowLiteC (= 2.2.0)
In Podfile:
firebase_ml_custom (from `.symlinks/plugins/firebase_ml_custom/ios`) was resolved to 0.0.1, which depends on
Firebase/MLModelInterpreter (= 6.33.0) was resolved to 6.33.0, which depends on
FirebaseMLModelInterpreter (~> 0.22.0) was resolved to 0.22.0, which depends on
TensorFlowLiteObjC (~> 2.3.0) was resolved to 2.3.0, which depends on
TensorFlowLiteC (= 2.3.0)
tflite (from `.symlinks/plugins/tflite/ios`) was resolved to 1.1.1, which depends on
TensorFlowLiteC
You have either:
* changed the constraints of dependency `TensorFlowLiteC` inside your development pod `firebase_ml_custom`.
You should run `pod update TensorFlowLiteC` to apply changes you've made."
Then I did a pod update TensorFlowLiteC
This rewrites my Podfile.lock to
- Protobuf (3.14.0)
- TensorFlowLiteC (2.3.0):
- TensorFlowLiteC/Core (= 2.3.0)
- TensorFlowLiteC/Core (2.3.0)
- TensorFlowLiteObjC (2.3.0):
- TensorFlowLiteC (= 2.3.0)
- tflite (1.1.1):
- Flutter
- TensorFlowLiteC
- video_player (0.0.1):
- Flutter
Are using firebase_ml_custom: ^0.2.0
? It looks like you have a transitive dependency clash, FirebaseMLModelInterpreter requires TensorFlowLiteObjC 2.3.0
Yes, this is what I have:
firebase_core: ^0.7.0 #firebase_core: ^0.5.3
firebase_ml_custom: ^0.2.0
tflite: ^1.1.1
Running the example app now and getting fatal error: 'metal_delegate.h' file not found #import "metal_delegate.h"
Is there a way to get pass this without downgrading?
Running the example app now and getting fatal error: 'metal_delegate.h' file not found #import "metal_delegate.h"
Is there a way to get pass this without downgrading?
yes, just comment it and the lines that depend on it. ypu will miss just the gpu delegate
This plugin needs updating to explicitly include the metal subspec, since it uses it in the implementation; https://www.tensorflow.org/lite/performance/gpu#ios_with_xcode
Since the podspec on this plugin doesn't specify a version range https://github.com/shaqian/flutter_tflite/blob/master/ios/tflite.podspec#L18 new users installing this plugin will get the latest version of TensorFlowLiteC
of which Metal doesn't exist in the main spec anymore. Modifying the Podfile.lock
isn't a solution
This worked for me:
https://github.com/shaqian/flutter_tflite/pull/243