No way to install tensorflow into homeassistant on raspberry pi 4

Following the official guide it was not possible (to me) to install tensorflow in home assistant.

Here my system conf:
Raspberry pi 4 model B – 4GB RAM – CPU Cortex A-72 – Architecture ARM
ASSOS 3.13
Home Assistant: 0110.1
Python vers. (Python3): 3.8.2
PIP3 versione: 20.1.1
Virtualenv version: 20.0.21

I was able to install the integration files and the model but tensorflow, through the pip install installation (env environment), is not successful.

The message is more or less always the same:
" ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow "

I followed various guides and information on the net for about 3 days but without success. I have come to the conclusion that the problem could the lack of a wheel configured for rasperry pi 4 and python 3.8.

I ask for help to confirm this, and to suggest (if I’m right) a revision of the official guide.

…or, alternatively, I ask you some help to correctly install tensorflow on my system.

I thank everyone and wish you a good HA-job.

By Pet

A quick google of the error message lead me to this https://github.com/tensorflow/tensorflow/issues/39130 according to that issue Python 3.8 isn’t supported by TF 2.1 but does suggest a RC build that should work.

Really thanks Gordon for the information and confirmation.
Can I ask you for a quick explanation (a link for example) to understand how to perform (and what is it) an RC build?

A ‘Release Candidate’ or RC build is an early version of the next version of software that the developers think is stable enough to use, but users may find bugs in it that we’re found in testing. So the build they suggest installing (https://github.com/tensorflow/tensorflow/issues/39130#issuecomment-623873008) is an early version of TF 2.2 that has been released for people to test, before it is released as an update for all users. As such it may bugs that cause other issues. If you’re not too familiar with software fault finding it may be worth waiting on the general release of 2.2.

1 Like

I am also trying to install tensorflow on a Python 3.8 system (Ubuntu 20.04 in my case). Tensorflow installs ok but we also have to re-build the models used in the Home Assistant Tensorflow integration from the model detection zoo, as they were exported with an older version of tensorflow. Specifically:

Our frozen inference graphs are generated using the v1.12.0 release version of Tensorflow and we do not guarantee that these will work with other versions; this being said, each frozen inference graph can be regenerated using your current version of Tensorflow by re-running the exporter, pointing it at the model directory as well as the corresponding config file in samples/configs.

I tried re-running the exporter but ran into a variety of import errors like

ImportError: cannot import name 'anchor_generator_pb2' from 'object_detection.protos' (/tmp/export/faster_rcnn_inception_v2_coco_2018_01_28/tf/research/object_detection/protos/__init__.py)

But I will keep trying.

1 Like

Just a quick update. I ended up giving the latest version of pytorch a try with the latest YOLOv5 object detection models. I now have a quasi-functional hacked-together custom-component that does this all on python 3.8. It actually runs on my nvidia GPU (Again, I’m running home assistant on an Ubuntu 20.04 server). This probably warrants a separate thread but just wanted to give a heads up.

I’d be interested in your setup. I’m also running on a Ubuntu 20.04 machine, albeit a VM (with a separate computer set up with 20.04 that I’ve been playing with YOLOv4 on). No GPU right now as I’m mostly proof of concepting how this will all work, I’ll improve the hardware later if I think it’s worth it.