once compiled, how does one install the tflite_runtime?

Okay and So,

I have, I think, installed the compiled versioning of a .whl file of tflite_runtime but my machine, the BBAI-64, refused to let me use it under the Debian distro…

Is there a particular route anyone has taken to install the compiled .whl file via pip3 or via python3 -m pip install MYWHEEL.whl file for usage on the BBAI-64?

And if so, what is the cure? Would I need to alter .bashrc and then source it or ldd or ln -s?

I cannot get how to install it even though it is installed on the system…

Seth

P.S. If you are working with tensorflow and tensorflow lite on the BBAI-64, please send suggestions!

not using BBAI-64, but what python version are you using ?
seems coral only works with python 3.9 or earlier
if your using python 3.11 or later, i’d like to know more about getting the .whl to work/compile

1 Like

Hi. Have you tried with debian-11.8-xfce-edgeai image? I mean - it is working right out of the box, “kinda”. At least python stuff.
Or you want to start from scratch?

3.12 is the Python3 versioning.

@amf99

cmake in the file called build_pip_package_with_cmake.sh and it is available.

So, git clone tensorflow at their github page online!

cd tensorflow_src
mkdir build && cd build
cmake ..

// the cmake can be made to handle arguments like with gnu

// Then...back to it

cmake --build .

On the BBAI-64, it completes but does not produce what I thought it would produce. Oh and I will mention that tensorflow and tensorflow_lite are very large packages. It takes a good day on the board.

I tried other ways. I kept failing at it. Something about mismanaged packages and no cure. anyway…

Also, in /home/debian/tensorflow_src/tensorflow/lite/tools/pip_package/, there is a file to help, e.g. helper script called build_pip_package_with_cmake.sh

Seth

P.S. I know that is wishy-washy right now but cmake and its good debugging will show evident. Also, there is a way with specific calls to “install” tflite_runtime.

Also!

/home/debian/tensorflow_src/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/dist/ is where you can find your .whl package once cmake builds it. And as usual, you can cross-compile and/or use bazel. bazel build --config=elinux_aarch64 and other compiler flags can go here to optimize the build for bazel building tensorflow… bazel build is in a different state for me.

That last sentence describes their state of building versus more apology-type debugging. The bazel build source, esp. if you are like me and do not know the ins, outs, and severity it can cause to an unknown system like the BBAI-64, is difficult. Plain and simple. I thought I kept getting further and further with bazel, not bazelisk which is “better,” to compile the tensorflow_lite .so file(s) to build further.

Now, is that true? Did I keep getting further to completion? Who knows? I do not. cmake won me over many times in my life.

Oh! Enough do-dad stuff…

bazel build //tensorflow/tools/pip_package:wheel --repo_env=WHEEL_NAME=tensorflow_cpu

With the correct bazel listed, this is how to install tensorflow on the cpu but cpu only. No, GPU or TPU or whatever else…

Aw! One last thing: My File naming scheme and the .tar file naming scheme...

-rw-rw-r-- 1 debian debian 2473713 Aug 2 11:29 tflite_runtime-2.18.0-cp312-cp312-linux_aarch64.whl
-rw-rw-r-- 1 debian debian 2486929 Aug 2 11:29 tflite_runtime-2.18.0.linux-aarch64.tar.gz

Good luck!

Scratch mostly.

Stress and completion. Two methods that are totally not healthy and keep me active!

Seth

also, you need clang++ and llvm of some form.

Seth

P.S. This may also prove valuable in your quest:

So,

I have been able to account for only Python3.12.x to accept the import tflite module but I cannot use any of its functions and/or classes for some reason.

Literally…

import tflite_runtime

Does not work no matter what version of Python I use.

import tflite

This works but only when calling it with python3.12 like a command…

So, python3.12 MY_PYTHON.py works and can account for the import tflite.

But…

when I use #!/usr/bin/python3.12 within the file and use chmod a+x or whatever I choose to show ownership of the file, it breaks. I may have to give in.

Argh…

Seth

I think I may be getting somewhere with libs. in context of building around the BBAI-64 and tensorflow…

Seth

P.S. I am going, without further evidence, to say this is solved…enjoy. @amf99 , it has something to do with ldconfig and not being in my user $PATH but with no further testing until later, this is a wrap for now. I will keep testing.

1 Like