Note: I have never worked with Tensorflow
Judging from pypi the only dependency problem here might be NumPy, but there's a recipe for it. So, we have NumPy, but there's no recipe for the Tensorflow itself. What now?
The answer is in the documentation on how to make a recipe.
First I'd look at the already working recipes, to actually understand how they work, especially the ones that work with C/C++ and not with Cython as it's a little bit easier to make a recipe for Cython (more even if you made the code).
These are the recipes I consider a basic stone for creating a recipe for Tensorflow:
Each of them has a part that will help you to assemble a working recipe. Now, there's a problem with the bindings. There are manylinux
wheels, but those most likely won't help you on Android (like at all) in the state they are. Therefore you'll need to build from source (obviously) and they have a whole folder related to that part.
That leads us to your piece of bazel
code. In build_pip_package.sh there's a lot of lines related to the bazel thingy.
So, after you understand how the recipes work there are two possibilities:
- your piece of code actually does something and builds it for android
- your code is worthless
If your code actually works, there's a good chance you'll be able to combine the already made setup.py
file into a simple-looking recipe hopefully just with another platform check (and using the correct bazel
binary I presume). As there already is setup.py
file, the package files should be moved to the Python that's compiled for Android.
On the other hand if the piece of code you pasted above is worthless, then you'll probably end up with compiling the code yourself + reinventing their setup.py
just for the P4A as a recipe. If you aren't familiar with the compilation steps required for building from source, I really don't envy you the process.
Also it might be a good thing to mention the size of the final APK. You can see Tensorflow on PyPI with just a small wheel of 13MB for Windows. Manylinux wheels, however, are huge (37-42MB) and I think you'll end up with a size inbetween those two for Android if you plan to install anything else than Tensorflow itself. There's always NumPy you'll have to drag with it to the phone as a dependency. So that gives you ~50MB+ APK file, which might not be really desired (depends on you).
This piece of code related to Python in their repo might help you too.