google-coral / edgetpu

Coral issue tracker (and legacy Edge TPU API source)
https://coral.ai
Apache License 2.0
429 stars 125 forks source link

Google Coral error: ValueError: Failed to load delegate from libedgetpu.so.1 #873

Open brechtBDCK opened 2 weeks ago

brechtBDCK commented 2 weeks ago

Description

Yes i have tried lots of things, including: https://github.com/tensorflow/tensorflow/issues/32743 https://github.com/google-coral/edgetpu/issues/536

my system: windows 11 with wsl 2 running, and a Google coral attached. The coral is shared through wsl, lsusb shows: Bus 002 Device 002: ID 1a6e:089a Global Unichip Corp.

python --version shows 3.9.20, although sudo apt-get install python3-pycoral errors with (might be the venv?)

Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-pycoral : Depends: python3-tflite-runtime (= 2.5.0.post1) but it is not going to be installed
                   Depends: python3 (< 3.10) but 3.10.6-1~22.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

The code i'm trying to run

import tflite_runtime.interpreter as tflite
from tflite_runtime.interpreter import load_delegate

def make_interpreter(model_path):
    interpreter = tflite.Interpreter(
        model_path=model_path,
        experimental_delegates=[load_delegate('libedgetpu.so.1')]
    )
    return interpreter
# Paths to your model and image
model_path = './smo_segmentation/yolo_seg_nano_512/weights/best_saved_model/best_full_integer_quant_edgetpu.tflite'
image_path = './YOLO/test/images/img_ (17).bmp'

# Create interpreter and allocate tensors
interpreter = make_interpreter(model_path)
interpreter.allocate_tensors()

but that immediately errors with:

Traceback (most recent call last):
  File "/home/bdck/PROJECTS/SMO/model_compression/venv_SMO_YOLO/lib/python3.9/site-packages/tflite_runtime/interpreter.py", line 182, in load_delegate
    delegate = Delegate(library, options)
  File "/home/bdck/PROJECTS/SMO/model_compression/venv_SMO_YOLO/lib/python3.9/site-packages/tflite_runtime/interpreter.py", line 120, in __init__
    raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bdck/PROJECTS/SMO/model_compression/YOLO/yolo_coral_inference.py", line 29, in <module>
    interpreter = make_interpreter(model_path)
  File "/home/bdck/PROJECTS/SMO/model_compression/YOLO/yolo_coral_inference.py", line 7, in make_interpreter
    experimental_delegates=[load_delegate('libedgetpu.so.1')]
  File "/home/bdck/PROJECTS/SMO/model_compression/venv_SMO_YOLO/lib/python3.9/site-packages/tflite_runtime/interpreter.py", line 184, in load_delegate
    raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from libedgetpu.so.1

pip freeze of my venv shows: absl-py==2.1.0 area==1.1.1 astunparse==1.6.3 attrs==24.2.0 certifi==2024.8.30 charset-normalizer==3.4.0 click==8.1.7 click-plugins==1.1.1 cligj==0.7.2 contourpy==1.3.0 cycler==0.12.1 fiona==1.10.1 flatbuffers==24.3.25 fonttools==4.54.1 gast==0.6.0 geopandas==1.0.1 google-pasta==0.2.0 grpcio==1.67.1 h5py==3.12.1 idna==3.10 importlib_metadata==8.5.0 importlib_resources==6.4.5 keras==3.6.0 kiwisolver==1.4.7 libclang==18.1.1 Markdown==3.7 markdown-it-py==3.0.0 MarkupSafe==3.0.2 matplotlib==3.9.2 mdurl==0.1.2 ml-dtypes==0.4.1 namex==0.0.8 numpy==2.0.2 opt_einsum==3.4.0 optree==0.13.0 packaging==24.1 pandas==2.2.3 pillow==11.0.0 progressbar2==4.5.0 protobuf==5.28.3 pycoral==0.2.0 Pygments==2.18.0 pyogrio==0.10.0 pyparsing==3.2.0 pyproj==3.6.1 python-dateutil==2.9.0.post0 python-utils==3.9.0 pytz==2024.2 requests==2.32.3 rich==13.9.3 shapely==2.0.6 six==1.16.0 tenacity==9.0.0 tensorboard==2.18.0 tensorboard-data-server==0.7.2 tensorflow-io-gcs-filesystem==0.37.1 termcolor==2.5.0 tflite==2.10.0 tflite-runtime==2.7.0 typing_extensions==4.12.2 tzdata==2024.2 urllib3==2.2.3 Werkzeug==3.0.6 wrapt==1.16.0 zipp==3.20.2

Click to expand! ### Issue Type Build/Install ### Operating System _No response_ ### Coral Device USB Accelerator ### Other Devices _No response_ ### Programming Language _No response_ ### Relevant Log Output _No response_