viseron
viseron copied to clipboard
tflite_runtime dependency issue on Jetson Nano
Actual error is:
**File "/usr/local/lib/python3.8/site-packages/tflite_runtime/interpreter.py", line 36, in <module>
from tflite_runtime import _pywrap_tensorflow_interpreter_wrapper as _interpreter_wrapper
ImportError: /lib/aarch64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/python3.8/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-38-aarch64-linux-gnu.so)**
Pull command: sudo docker pull roflcoopter/jetson-nano-viseron May be relevant: https://github.com/google-coral/edgetpu/issues/410
sudo docker container run --rm --runtime nvidia --gpus all --privileged \
-v /home/scott/viseron:/config \
-v /dev/bus/usb:/dev/bus/usb \
-v /etc/localtime:/etc/localtime:ro \
-v /home/scott/viseron/recordings:/recordings \
--privileged \
--tmpfs /tmp \
--name viseron \
roflcoopter/jetson-nano-viseron:latest
Log:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 10-adduser: executing...
************************ UID/GID *************************
User uid: 0
User gid: 0
************************** Done **************************
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-gid-video-device: executing...
[cont-init.d] 20-gid-video-device: exited 0.
[cont-init.d] 30-edgetpu-permission: executing...
************** Setting EdgeTPU permissions ***************
Coral Vendor IDs:
"1a6e",ATTRS{idProduct}=="089a"
"18d1",ATTRS{idProduct}=="9302"
Matching USB devices:
Bus 002 Device 004: ID 18d1:9302 Google Inc.
************************** Done **************************
[cont-init.d] 30-edgetpu-permission: exited 0.
[cont-init.d] 40-set-env-vars: executing...
****** Checking for hardware acceleration platforms ******
OpenCL cannot be used
VA-API cannot be used
CUDA is available!
*********************** Done *****************************
[cont-init.d] 40-set-env-vars: exited 0.
[cont-init.d] 50-check-if-rpi: executing...
********** Checking if we are running on an RPi **********
Not running on any supported RPi
*********************** Done *****************************
[cont-init.d] 50-check-if-rpi: exited 0.
[cont-init.d] 55-check-if-jetson: executing...
****** Checking if we are running on a Jetson Board ******
Running on a Jetson Nano
*********************** Done *****************************
[cont-init.d] 55-check-if-jetson: exited 0.
[cont-init.d] 60-ffmpeg-path: executing...
****************** Getting FFmpeg path *******************
FFmpeg path: /usr/local/bin/ffmpeg
*********************** Done *****************************
[cont-init.d] 60-ffmpeg-path: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2021-10-19 20:51:28] [INFO ] [viseron ] - -------------------------------------------
[2021-10-19 20:51:28] [INFO ] [viseron ] - Initializing...
[2021-10-19 20:51:28] [INFO ] [viseron.mqtt ] - Initializing MQTT connection
Traceback (most recent call last):
File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/src/viseron/__main__.py", line 16, in <module>
init()
File "/src/viseron/__main__.py", line 13, in init
main()
File "/src/viseron/__main__.py", line 7, in main
Viseron()
File "/src/viseron/__init__.py", line 58, in __init__
detector = Detector(config.object_detection)
File "/src/viseron/detector/__init__.py", line 60, in __init__
config_module, detector_module = import_object_detection(
File "/src/viseron/detector/__init__.py", line 120, in import_object_detection
detector_module = importlib.import_module(
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/src/viseron/detector/edgetpu/__init__.py", line 8, in <module>
import tflite_runtime.interpreter as tflite
File "/usr/local/lib/python3.8/site-packages/tflite_runtime/interpreter.py", line 36, in <module>
from tflite_runtime import _pywrap_tensorflow_interpreter_wrapper as _interpreter_wrapper
ImportError: /lib/aarch64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/python3.8/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-38-aarch64-linux-gnu.so)
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
I am a current Frigate user who bought a Jetson Nano to lower power requirements from the Haswell GT640 + edge TPU that I currently use. I had incorrectly assumed that Jetson Nano had same de/encoder hardware as the Nvidia gpu's with same ffmpeg compatibility. Somewhat disappointed to find how limited ffmpeg support is on Jetson, eg no hardware scaling for the detection pipeline. Seems nvidia focussed on gstreamer instead. I found Viseron when trawling for solutions to lower CPU use as I had hoped to run Home Assistant on the Jetson as well as my NVR, likely I will be using a Rockchip RK3399 SBC that I already have for HAssistant. Anyway I can see there are many features in Viseron that are missing in Frigate, so I am excited to try them out. Thanks for the hard work.
The Nano implementation in Viseron is a special little beast... I struggled a lot with getting FFmpeg to work at all.
The underlying issue is that Viseron requires Python 3.8 or higher, and NVIDIA have not made an image for the Nano which is based on Ubuntu 20.04 which all the other Docker images are using.
For this reason i have had to create a separate image which compiles python 3.8 and include it into my Nano base image. It seems that this doesnt fully work then and some more dependencies have to be built manually.
I am currently rewriting Viseron to be more component based (just like Home Assistant). The end goal is to have all the bits and pieces less coupled which would allow for easy integration of new components, gstreamer for instance. I proably wont have time to look at this until the rewrite is complete unfortunately
I dont know if this helps, but I built Frigate on jetson nano myself as I wanted certain features. For ffmpeg the Frigate dockerfile is very similar to Viseron. I used:
Dockerfile.ffmpeg.aarch64nvmpi FROM balenalib/jetson-nano-ubuntu:bionic AS base
which is 18.04 because I ran into dependency issues on 20.04. The base frigate image was also 18.04, but wheels were built using FROM ubuntu:20.04 as build
I am not very experienced in docker, so I just fumble around until it works. I do also remove a lot of redundant stuff from ffmpeg build - there's a lot of old codecs and stuff in there for frame grabbing from Xfree86/Desktop, and libzmq which is for interacting with filter graphs etc which I dont think anyone uses with NVR systems. attached is my ffmpeg dockerfile, which is bare bones for use case, ie hardware decoding of h264, and recordings are just copied to segments. Hope this helps.
Dockerfile.ffmpeg.aarch64nvmpi.gz
Fixed now in #306
Closed in v2