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

fatal error: 'tensorflow/lite/c/c_api.h' file not found #91

Closed
Pingou opened this issue Sep 24, 2024 · 22 comments · Fixed by #112
Closed

fatal error: 'tensorflow/lite/c/c_api.h' file not found #91

Pingou opened this issue Sep 24, 2024 · 22 comments · Fixed by #112

Comments

@Pingou
Copy link

Pingou commented Sep 24, 2024

on 1.4.0, I have the following error on mac m2 when compiling:

In file included from /Users/pingou/react/app/node_modules/react-native-fast-tflite/cpp/TensorHelpers.cpp:9:
/Users/pingou/react/app/node_modules/react-native-fast-tflite/android/../cpp/TensorHelpers.h:15:10: fatal error: 'tensorflow/lite/c/c_api.h' file not found
#include <tensorflow/lite/c/c_api.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~

@asadwan
Copy link

asadwan commented Sep 30, 2024

I'm having the same issue.

@Clcada3301
Copy link

Clcada3301 commented Oct 1, 2024

I'm having the same issue.
fatal error: 'tensorflow/lite/c/c_api.h' file not found

@CannoChen
Copy link

Same issue here. Any one have solution?

@wojciech-kubiak
Copy link

Same here. Temporary fix is to manually clone tensorflow repo into node_modules/react-native-fast-tflite/.
This is removed every time you run yarn install, but you can build the app for now.

@CannoChen
Copy link

Same here. Temporary fix is to manually clone tensorflow repo into node_modules/react-native-fast-tflite/. This is removed every time you run yarn install, but you can build the app for now.

Can you elaborate on your solution? Exactly which module of tensorflow is copied in?

@wojciech-kubiak
Copy link

Can you elaborate on your solution? Exactly which module of tensorflow is copied in?

Exactly the one i linked.

@Miraii133
Copy link

Can you elaborate on your solution? Exactly which module of tensorflow is copied in?

Exactly the one i linked.

By clone tensor flow repo, did you mean the entire repo of tensorflow?

@wojciech-kubiak
Copy link

wojciech-kubiak commented Oct 1, 2024

By clone tensor flow repo, did you mean the entire repo of tensorflow?

yes, the entire repo.

EDIT:
I cloned the entire repo but it's not necessary, see below.

@CannoChen
Copy link

Can you elaborate on your solution? Exactly which module of tensorflow is copied in?

Exactly the one i linked.

By clone tensor flow repo, did you mean the entire repo of tensorflow?

No, It is not neccessary! The only thing you must do is to copy tensorflow/lite dir to react-native-fast-tflite/cpp.

In my project, It work fine! But, I meet other issue again. It can't read my tflite model now!

@manu13008
Copy link

@CannoChen was the next issue related also to this issue ?
Thanks

@Pingou
Copy link
Author

Pingou commented Oct 4, 2024

Same here. Temporary fix is to manually clone tensorflow repo into node_modules/react-native-fast-tflite/. This is removed every time you run yarn install, but you can build the app for now.

have you tried pointing to master instead of the npm version?
Ex of package.json: "react-native-fast-tflite": "git://github.com/mrousavy/react-native-fast-tflite#master",

@lucksp
Copy link

lucksp commented Oct 6, 2024

Are you seeing this on Android & iOS?

I am seeing only in Android

@diegomeire
Copy link

diegomeire commented Oct 6, 2024

This is what I did to solve it:
1- Added the package normally through yarn add react-native-fast-tflite
2- Kept a copy of tensorflow in the app folder
3- Added a post install script on package.json to copy the tensorflow folder to node_modules: "postinstall": "cp -r ./tensorflow ./node_modules/react-native-fast-tflite"

Now, every time I run yarn install or add another package, the tensorflow folder is re-copied.
This worked for me. Hope it helps

@JamTheDev
Copy link

Same problem here. I hope a solution can be delivered this week . I need TFLite for my project. Thanks

@manu13008
Copy link

Same problem here. I hope a solution can be delivered this week . I need TFLite for my project. Thanks

Just take the 1.3.0 version while waiting for the issue to be fixed.

@CannoChen
Copy link

Same problem here. I hope a solution can be delivered this week . I need TFLite for my project. Thanks

You can try using tensorflowjs directly. For me, I gave up using this repo. after I used tensorflowjs, my project worked correctly. You can find the code in my project: https://github.com/CannoChen/SmartBMS

@CannoChen
Copy link

@CannoChen was the next issue related also to this issue ? Thanks

No, it isn't. In my view, I dont suggest you to use this repo. I suggest that you should use tensorflowjs directly!!! It more simple, and more close to tensorflow_lite model.

@lucksp
Copy link

lucksp commented Oct 9, 2024

@CannoChen was the next issue related also to this issue ? Thanks

No, it isn't. In my view, I dont suggest you to use this repo. I suggest that you should use tensorflowjs directly!!! It more simple, and more close to tensorflow_lite model.

I’d like to try using TFJS directly. But are the docs from tensorflow correct to install in React native?

@CannoChen
Copy link

@CannoChen was the next issue related also to this issue ? Thanks

No, it isn't. In my view, I dont suggest you to use this repo. I suggest that you should use tensorflowjs directly!!! It more simple, and more close to tensorflow_lite model.

I’d like to try using TFJS directly. But are the docs from tensorflow correct to install in React native?

Of course, you can! But there are some tricks that you may focus:

@RayanMoarkech
Copy link

I think this issue is related to the file change to android/CMakeLists.txt
35d7cbd

@lucksp
Copy link

lucksp commented Nov 21, 2024

any update on this? I need the fix in 1.5.0 to load file on android...but tensorflow/lite/c/c_api.h missing is still throwing an error.

@lucksp
Copy link

lucksp commented Nov 24, 2024

For those interested, please test #112 PR posted from @bang9

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

Successfully merging a pull request may close this issue.