I’m using the official Python docker images to deploy my project to an ARM-based Azure Virtual Machine. Here are the VM specifications:
- Architecture: aarch64 (Standard_D4plds_v5)
- OS: Ubuntu 20.04
- vCPU: 4
- RAM: 8GB
tflite-runtime library (v2.5.0) and python 3.8.10 to run a .tflite model. However, after the build, when I run the container, it throws the following error:
Traceback (most recent call last): File "./app.py", line 17, in <module> from hpstate import HPStatePreprocessor, HPStateLiteModel, Timer File "/usr/src/app/hpstate.py", line 6, 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)
I tried different images such as slim, buster, and slim-buster, but no success.
It seems that the current GLIBC installed on the machine is 2.31:
$ sudo apt-cache policy libc6
Installed: 2.31-0ubuntu9.9 Candidate: 2.31-0ubuntu9.9 Version table: *** 2.31-0ubuntu9.9 500 500 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 Packages 100 /var/lib/dpkg/status 2.31-0ubuntu9.7 500 500 http://ports.ubuntu.com/ubuntu-ports focal-security/main arm64 Packages 2.31-0ubuntu9 500 500 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages
Another thing I tried was to use a more recent python version (3.9.14), which is supported by
tflite-runtime together with a more recent
tflite-runtime version (>=2.7.0), and in that scenario, I get the following error when calling
Traceback (most recent call last): File "/usr/src/app/./app.py", line 188, in <module> main() File "/usr/src/app/./app.py", line 120, in main model = HPStateLiteModel(model_path=MODEL_FILE_PATH) File "/usr/src/app/hpstate.py", line 98, in __init__ self._initialize_model(model_path) File "/usr/src/app/hpstate.py", line 102, in _initialize_model interpreter.allocate_tensors() File "/usr/local/lib/python3.9/site-packages/tflite_runtime/interpreter.py", line 521, in allocate_tensors return self._interpreter.AllocateTensors() RuntimeError: Select TensorFlow op(s), included in the given model, is(are) not supported by this interpreter. Make sure you apply/link the Flex delegate before inference. For the Android, it can be resolved by adding "org.tensorflow:tensorflow-lite-select-tf-ops" dependency. See instructions: https://www.tensorflow.org/lite/guide/ops_selectNode number 7 (FlexRange) failed to prepare.
I got the same errors using another ARM-based VM (with the same spec.) with Ubuntu 18.04. The pre-installed GLIBC version installed on that machine was 2.28. Any idea how can fix this issue?
You are building your binary against system GLIBC-2.31, and are trying to run in a container with older GLIBC (Debian buster used GLIBC-2.28 as far as I can tell).
That doesn’t work (as you’ve discovered).
Your best bet is to build your binaries inside a docker image you are targeting (or rather in a docker image based on the same OS release).
Answered By – Employed Russian