oberluz / pycoral

Python API for ML inferencing and transfer-learning on Coral devices
https://coral.ai
Apache License 2.0
34 stars 2 forks source link

Plans to built 2.7.0 for Python 3.11? #6

Closed nmaas87 closed 10 months ago

nmaas87 commented 10 months ago

Just wanted to ask if its feasible to build 2.7.0 for Python 3.11? I wanted to try it on an ARM64 device, which gives errors with 2.13.0 and has Python 3.11

Traceback (most recent call last):
  File "/home/apex/pycoral-master/examples/classify_image.py", line 121, in <module>
    main()
  File "/home/apex/pycoral-master/examples/classify_image.py", line 71, in main
    interpreter = make_interpreter(*args.model.split('@'))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/tflite_runtime/interpreter.py", line 166, in load_delegate
    delegate = Delegate(library, options)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/tflite_runtime/interpreter.py", line 74, in __init__
    self._library.tflite_plugin_create_delegate.argtypes = [
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ctypes/__init__.py", line 389, in __getattr__
    func = self.__getitem__(name)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ctypes/__init__.py", line 394, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: /usr/lib/libedgetpu.so.1: undefined symbol: tflite_plugin_create_delegate
Exception ignored in: <function Delegate.__del__ at 0x7f8d47b600>
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/tflite_runtime/interpreter.py", line 110, in __del__
    self._library.tflite_plugin_destroy_delegate.argtypes = [ctypes.c_void_p]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ctypes/__init__.py", line 389, in __getattr__
    func = self.__getitem__(name)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ctypes/__init__.py", line 394, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: /usr/lib/libedgetpu.so.1: undefined symbol: tflite_plugin_destroy_delegate

I also tried it on a x64 Debian 11 machine with Python 3.9 using 2.13.0 and only got a segmantation fault on trying to run the python example:

python3 examples/classify_image.py --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels test_data/inat_bird_labels.txt --input test_data/parrot.jpg
[ 1879.636483] python3[1089]: segfault at 218b390 ip 00007fc54ac859bb sp 00007ffdd15c0288 error 4 in _pywrap_tensorflow_interpreter_wrapper.so[7fc54ac2c000+456000]
[ 1879.636489] Code: 0f 1e fa 4c 8b 46 40 49 89 d1 48 89 ca 4d 85 c0 74 36 49 63 40 3c 83 f8 ff 74 24 48 8d 04 80 48 c1 e0 05 48 03 87 e8 00 00 00 <48> 8b 40 50 48 85 c0 74 1d 48 83 c7 28 4c 89 ce ff e0 0f 1f 00 49
root@yocto:/home/user/pycoral#

So I'd like to see if I could get 2.7.0 running on the ARM64 machine as 2.7.0 also worked fine on the x64 Debian machine, thanks!

oberluz commented 10 months ago

Can't be done. tensorflow lite only started support for python 3.11 from v2.13.0 onwards.