synesthesiam/homeassistant-satellite

Fails to start with activated silerovad on raspi 4

Opened this issue · 5 comments

When I try to include --vad silero in the start then I get the following error.
It's a raspi 4 with raspbian 11

Oct 15 11:26:29 hyperion systemd[1]: Started Home Assistant Satellite.
Oct 15 11:26:30 hyperion run[3481]: CRITICAL:root:Please pip install homeassistant_satellite[silerovad]
Oct 15 11:26:30 hyperion run[3481]: ERROR:main:Unexpected error in _mic_proc
Oct 15 11:26:30 hyperion run[3481]: Traceback (most recent call last):
Oct 15 11:26:30 hyperion run[3481]: File "/home/pi/homeassistant-satellite/.venv/lib/python3.9/site-packages/numpy/core/init.py", line 23, in
Oct 15 11:26:30 hyperion run[3481]: from . import multiarray
Oct 15 11:26:30 hyperion run[3481]: File "/home/pi/homeassistant-satellite/.venv/lib/python3.9/site-packages/numpy/core/multiarray.py", line 10, in
Oct 15 11:26:30 hyperion run[3481]: from . import overrides
Oct 15 11:26:30 hyperion run[3481]: File "/home/pi/homeassistant-satellite/.venv/lib/python3.9/site-packages/numpy/core/overrides.py", line 8, in
Oct 15 11:26:30 hyperion run[3481]: from numpy.core._multiarray_umath import (
Oct 15 11:26:30 hyperion run[3481]: ImportError: libcblas.so.3: cannot open shared object file: No such file or directory
Oct 15 11:26:30 hyperion run[3481]: During handling of the above exception, another exception occurred:
Oct 15 11:26:30 hyperion run[3481]: Traceback (most recent call last):
Oct 15 11:26:30 hyperion run[3481]: File "/home/pi/homeassistant-satellite/homeassistant_satellite/main.py", line 276, in _mic_proc
Oct 15 11:26:30 hyperion run[3481]: vad = SileroVoiceActivityDetector(args.vad_model)
Oct 15 11:26:30 hyperion run[3481]: File "/home/pi/homeassistant-satellite/homeassistant_satellite/vad.py", line 27, in init
Oct 15 11:26:30 hyperion run[3481]: import numpy as np
Oct 15 11:26:30 hyperion run[3481]: File "/home/pi/homeassistant-satellite/.venv/lib/python3.9/site-packages/numpy/init.py", line 139, in
Oct 15 11:26:30 hyperion run[3481]: from . import core
Oct 15 11:26:30 hyperion run[3481]: File "/home/pi/homeassistant-satellite/.venv/lib/python3.9/site-packages/numpy/core/init.py", line 49, in
Oct 15 11:26:30 hyperion run[3481]: raise ImportError(msg)
Oct 15 11:26:30 hyperion run[3481]: ImportError:
Oct 15 11:26:30 hyperion run[3481]: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Oct 15 11:26:30 hyperion run[3481]: Importing the numpy C-extensions failed. This error can happen for
Oct 15 11:26:30 hyperion run[3481]: many reasons, often due to issues with your setup or how NumPy was
Oct 15 11:26:30 hyperion run[3481]: installed.
Oct 15 11:26:30 hyperion run[3481]: We have compiled some common reasons and troubleshooting tips at:
Oct 15 11:26:30 hyperion run[3481]: https://numpy.org/devdocs/user/troubleshooting-importerror.html
Oct 15 11:26:30 hyperion run[3481]: Please note and check the following:
Oct 15 11:26:30 hyperion run[3481]: * The Python version is: Python3.9 from "/home/pi/homeassistant-satellite/.venv/bin/python3"
Oct 15 11:26:30 hyperion run[3481]: * The NumPy version is: "1.25.2"
Oct 15 11:26:30 hyperion run[3481]: and make sure that they are the versions you expect.
Oct 15 11:26:30 hyperion run[3481]: Please carefully study the documentation linked above for further help.
Oct 15 11:26:30 hyperion run[3481]: Original error was: libcblas.so.3: cannot open shared object file: No such file or directory
Oct 15 11:26:30 hyperion run[3480]: Traceback (most recent call last):
Oct 15 11:26:30 hyperion run[3480]: File "/home/pi/homeassistant-satellite/script/run", line 13, in
Oct 15 11:26:30 hyperion run[3480]: subprocess.check_call(
Oct 15 11:26:30 hyperion run[3480]: File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
Oct 15 11:26:30 hyperion run[3480]: raise CalledProcessError(retcode, cmd)
Oct 15 11:26:30 hyperion run[3480]: subprocess.CalledProcessError: Command '['/home/pi/homeassistant-satellite/.venv/bin/python3', '-m', 'homeassistant_satellite', '--host', '192.168.178.156', '--token', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiMTE2OWUyNGUzYmU0NmIyYmYwMGVhYTI2ODMzNzMzNSIsImlhdCI6MTY5NzIxNzkwNiwiZXhwIjoyMDEyNTc3OTA2fQ.pDTqt01wj_JHyRJdqo2qXrOaHLVF5NteOqOtqD71Ou8', '--mic-device', 'plughw:CARD=S330', '--snd-device', 'plughw:CARD=S330', '--vad', 'silero', '--noise-suppression', '1']' returned non-zero exit status 255.
Oct 15 11:26:30 hyperion systemd[1]: homeassistant-satellite.service: Main process exited, code=exited, status=1/FAILURE
Oct 15 11:26:30 hyperion systemd[1]: homeassistant-satellite.service: Failed with result 'exit-code'.

The installation of silerovad itself looked like this:

.venv/bin/pip3 install
--find-links https://synesthesiam.github.io/prebuilt-apps/
.[silerovad]
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Looking in links: https://synesthesiam.github.io/prebuilt-apps/
Processing /home/pi/homeassistant-satellite
Preparing metadata (setup.py) ... done
Requirement already satisfied: aiohttp==3.8.4 in ./.venv/lib/python3.9/site-packages (from homeassistant-satellite==2.2.0) (3.8.4)
Collecting onnxruntime<2,>=1.10.0 (from homeassistant-satellite==2.2.0)
Downloading https://github.com/synesthesiam/prebuilt-apps/releases/download/v1.0/onnxruntime-1.10.0-cp39-cp39-linux_armv7l.whl (5.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.4/5.4 MB 5.8 MB/s eta 0:00:00
Collecting numpy<1.26 (from homeassistant-satellite==2.2.0)
Downloading https://www.piwheels.org/simple/numpy/numpy-1.25.2-cp39-cp39-linux_armv7l.whl (12.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.5/12.5 MB 7.2 MB/s eta 0:00:00
Requirement already satisfied: attrs>=17.3.0 in ./.venv/lib/python3.9/site-packages (from aiohttp==3.8.4->homeassistant-satellite==2.2.0) (23.1.0)
Requirement already satisfied: charset-normalizer<4.0,>=2.0 in ./.venv/lib/python3.9/site-packages (from aiohttp==3.8.4->homeassistant-satellite==2.2.0) (3.3.0)
Requirement already satisfied: multidict<7.0,>=4.5 in ./.venv/lib/python3.9/site-packages (from aiohttp==3.8.4->homeassistant-satellite==2.2.0) (6.0.4)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in ./.venv/lib/python3.9/site-packages (from aiohttp==3.8.4->homeassistant-satellite==2.2.0) (4.0.3)
Requirement already satisfied: yarl<2.0,>=1.0 in ./.venv/lib/python3.9/site-packages (from aiohttp==3.8.4->homeassistant-satellite==2.2.0) (1.9.2)
Requirement already satisfied: frozenlist>=1.1.1 in ./.venv/lib/python3.9/site-packages (from aiohttp==3.8.4->homeassistant-satellite==2.2.0) (1.4.0)
Requirement already satisfied: aiosignal>=1.1.2 in ./.venv/lib/python3.9/site-packages (from aiohttp==3.8.4->homeassistant-satellite==2.2.0) (1.3.1)
Collecting protobuf (from onnxruntime<2,>=1.10.0->homeassistant-satellite==2.2.0)
Downloading https://www.piwheels.org/simple/protobuf/protobuf-4.24.4-cp39-cp39-linux_armv7l.whl (907 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 907.2/907.2 kB 3.7 MB/s eta 0:00:00
Collecting flatbuffers (from onnxruntime<2,>=1.10.0->homeassistant-satellite==2.2.0)
Downloading https://www.piwheels.org/simple/flatbuffers/flatbuffers-20181003210633-py2.py3-none-any.whl (14 kB)
Requirement already satisfied: idna>=2.0 in ./.venv/lib/python3.9/site-packages (from yarl<2.0,>=1.0->aiohttp==3.8.4->homeassistant-satellite==2.2.0) (3.4)
Building wheels for collected packages: homeassistant-satellite
Building wheel for homeassistant-satellite (setup.py) ... done
Created wheel for homeassistant-satellite: filename=homeassistant_satellite-2.2.0-py3-none-any.whl size=1528625 sha256=69fa56560c2e471fe9b1ddc3e56fd5c6b681f1a97581cb57a17de175f8adae47
Stored in directory: /home/pi/.cache/pip/wheels/5d/22/a4/24709704cd825622541773fc00f75e1ba394c132605fe56cf8
Successfully built homeassistant-satellite
Installing collected packages: flatbuffers, protobuf, numpy, onnxruntime, homeassistant-satellite
Attempting uninstall: homeassistant-satellite
Found existing installation: homeassistant-satellite 2.2.0
Uninstalling homeassistant-satellite-2.2.0:
Successfully uninstalled homeassistant-satellite-2.2.0
Successfully installed flatbuffers-20181003210633 homeassistant-satellite-2.2.0 numpy-1.25.2 onnxruntime-1.10.0 protobuf-4.24.4

try sudo apt install libatlas3-base

Then we are at the following error:

ERROR:main:Unexpected error in _mic_proc
Traceback (most recent call last):
File "/home/pi/homeassistant-satellite/homeassistant_satellite/main.py", line 276, in _mic_proc
vad = SileroVoiceActivityDetector(args.vad_model)
File "/home/pi/homeassistant-satellite/homeassistant_satellite/vad.py", line 39, in init
self.session = onnxruntime.InferenceSession(
File "/home/pi/homeassistant-satellite/.venv/lib/python3.9/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 335, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "/home/pi/homeassistant-satellite/.venv/lib/python3.9/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 368, in _create_inference_session
sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from /home/pi/homeassistant-satellite/homeassistant_satellite/models/silero_vad.onnx failed:/home/pi/Documents/ort/build/onnxruntime/onnxruntime/core/graph/model_load_utils.h:47 void onnxruntime::model_load_utils::ValidateOpsetForDomain(const std::unordered_map<std::__cxx11::basic_string, int>&, const onnxruntime::logging::Logger&, bool, const string&, int) ONNX Runtime only guarantees support for models stamped with official released onnx opset versions. Opset 16 is under development and support for this is limited. The operator schemas and or other functionality may change before next ONNX release and in this case ONNX Runtime will not guarantee backward compatibility. Current official support for domain ai.onnx is till opset 15.

Traceback (most recent call last):
File "/home/pi/homeassistant-satellite/script/run", line 13, in
subprocess.check_call(
File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)

Hm, it looks like your pip install picked onnxruntime==1.10.0 from https://synesthesiam.github.io/prebuilt-apps/, cause you run 32bit arm and pypi only has arm64 wheels.

But this is an old version and likely doesn't supoprt the current silero model. I tried to install onnxruntime==1.10.0 on my pi and I get the same error.

@synesthesiam : maybe you can upload a new onnxruntime build for armv7l?

Hi @synesthesiam , could you please upload onnxruntime-1.11.0 for armv7l?

I'm working on new 32-bit builds for onnxruntime. I really wish Python didn't require a different wheel for every version.