rajurimu
rajurimu

Reputation: 51

ModuleNotFoundError: No module named 'tflite_runtime'

I am trying to install Tensorflow Lite on RPI Zero as a standalone. However once installation is complete as per the steps.

I can not import,

import tflite_runtime.interpreter as tflite

The error I am getting is:

ModuleNotFoundError: No module named 'tflite_runtime'

In addition as per the instructions, I should see a static library. I do not see this either. tensorflow/lite/tools/make/gen/lib/rpi_armv6/libtensorflow-lite.a

Here is my setup:

Upvotes: 5

Views: 23362

Answers (2)

Unmitigated
Unmitigated

Reputation: 89472

This error means that Tensorflow Lite has not been installed.

To install it, follow the instructions on the official site:

If you're running Debian Linux or a derivative of Debian (including Raspberry Pi OS), you should install from our Debian package repo. This requires that you add a new repo list and key to your system and then install as follows:
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install python3-tflite-runtime

For all other systems, you can install with pip:

pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime

If you'd like to manually install a Python wheel, you can select one from all tflite_runtime wheels.

Upvotes: 4

Pulkeet Gupta
Pulkeet Gupta

Reputation: 1

Tensorflow lite framework has been developed for embedded devices based on Linux. Eg. Coral by Google, Raspberry Pi and others.

In order to get rid of this error, we can install the tflite framework based on the device. For Linux based ARM x64 boards having python3.6, please use

pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp36-cp36m-linux_aarch64.whl

For more information, please check out the link here

Upvotes: 0

Related Questions