Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run 'Getting started examples' for USB Accelerator on Windows 10: "ValueError: Failed to load delegate from edgetpu.dll" #39

Closed
asylunatic opened this issue Aug 4, 2021 · 22 comments
Assignees
Labels
Hardware:USB Accelerator Coral USB Accelerator issues stat:awaiting response Status - Awaiting response from author subtype:windows Windos Build/installation issues type:build/install Build and install issues

Comments

@asylunatic
Copy link

On two different Windows 10 machines I run into the same problem when trying to run the pycoral example for the USB Accelerator. In both cases, I followed the steps from https://coral.ai/docs/accelerator/get-started/ . When trying to run classify_image.py, the script crashes when calling make_interpreter:

  File "C:\Users\Gebruiker\Documents\Thesis\CoralSetup\venv\lib\site-packages\tflite_runtime\interpreter.py", line 160, in load_delegate
    delegate = Delegate(library, options)
  File "C:\Users\Gebruiker\Documents\Thesis\CoralSetup\venv\lib\site-packages\tflite_runtime\interpreter.py", line 119, in __init__
    raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Gebruiker\Documents\Thesis\CoralSetup\coral\pycoral\examples\classify_image.py", line 121, in <module>
    main()
  File "C:\Users\Gebruiker\Documents\Thesis\CoralSetup\coral\pycoral\examples\classify_image.py", line 71, in main
    interpreter = make_interpreter(*args.model.split('@'))
  File "C:\Users\Gebruiker\Documents\Thesis\CoralSetup\venv\lib\site-packages\pycoral\utils\edgetpu.py", line 87, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
  File "C:\Users\Gebruiker\Documents\Thesis\CoralSetup\venv\lib\site-packages\pycoral\utils\edgetpu.py", line 52, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
  File "C:\Users\Gebruiker\Documents\Thesis\CoralSetup\venv\lib\site-packages\tflite_runtime\interpreter.py", line 163, in load_delegate
    library, str(e)))
ValueError: Failed to load delegate from edgetpu.dll

On both machines, it the first time I did the installation, so I am pretty sure it does not have to do with versions (as was suggested in issues raised earlier: #281 and #46).

I have so far not been able to find out what causes this.

@manoj7410
Copy link
Contributor

@asylunatic Do you see any LED glowing on the USB Accelerator ?

@asylunatic
Copy link
Author

@manoj7410 yes! it is also listed in the device manager under USB devices, and I've added the path to edgetpu.dll to the environment variables to be sure

@hjonnala
Copy link
Contributor

hjonnala commented Aug 4, 2021

@asylunatic could you please try with edgetpu_runtime_20210119.zip from this page https://coral.ai/software/#edgetpu-runtime

@hjonnala hjonnala self-assigned this Aug 4, 2021
@hjonnala hjonnala added Hardware:USB Accelerator Coral USB Accelerator issues stat:awaiting response Status - Awaiting response from author subtype:windows Windos Build/installation issues type:build/install Build and install issues labels Aug 4, 2021
@Lennyz1988
Copy link

Lennyz1988 commented Aug 4, 2021

I'm having the same issue but on an aarch64 system. I just updated everything to the latest versions.

pycoral 2.0.0
tflite-runtime 2.5.0.post1

I tried these trained models:
tf2_ssd_mobilenet_v2_coco17_ptq_edgetpu.tflite
mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite (was working fine before the update)

Traceback (most recent call last):
  File "/home/lennyz1988/.local/lib/python3.7/site-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
    delegate = Delegate(library, options)
  File "/home/lennyz1988/.local/lib/python3.7/site-packages/tflite_runtime/interpreter.py", line 119, in __init__
    raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "coralkolksluis.py", line 163, in <module>
    classify_frame(model_file)
  File "coralkolksluis.py", line 111, in classify_frame
    interpreter = edgetpu.make_interpreter(model_file)
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
  File "/home/lennyz1988/.local/lib/python3.7/site-packages/tflite_runtime/interpreter.py", line 163, in load_delegate
    library, str(e)))
ValueError: Failed to load delegate from libedgetpu.so.1

@hjonnala
Copy link
Contributor

hjonnala commented Aug 4, 2021

@Lennyz1988 can you paste the output of command lsusb

@Lennyz1988
Copy link

Lennyz1988 commented Aug 4, 2021

@hjonnala

Bus 008 Device 002: ID 2109:0817 VIA Labs, Inc.
Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 002: ID 2109:2817 VIA Labs, Inc.
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

@hjonnala
Copy link
Contributor

hjonnala commented Aug 4, 2021

@Lennyz1988 I assume you are using USB accelerator. If its connected you should see Global Unichip Corp. or Google in ouput.
Do you see any LED glowing on the USB Accelerator ?

(my_app_venv) hemanthreddyj@hemanthreddyj-glaptop:~$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 1050:0200 Yubico.com Gnubby U2F
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 010: ID 1a6e:089a Global Unichip Corp.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 138a:0097 Validity Sensors, Inc. 
Bus 001 Device 003: ID 13d3:5682 IMC Networks SunplusIT Integrated Camera
Bus 001 Device 002: ID 8087:0a2b Intel Corp. Bluetooth wireless interface
Bus 001 Device 010: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

@AkkiSony
Copy link

AkkiSony commented Aug 6, 2021

$ python examples/classify_image.py -m test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite -l test_data/inat_bird_labels.txt -i test_data/parrot.jpg
Traceback (most recent call last):
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\tflite_runtime\interpreter.py", line 160, in load_delegate
delegate = Delegate(library, options)
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\tflite_runtime\interpreter.py", line 119, in init
raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "examples/classify_image.py", line 85, in
main()
File "examples/classify_image.py", line 62, in main
interpreter = make_interpreter(*args.model.split('@'))
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\pycoral\utils\edgetpu.py", line 87, in make_interpreter
delegates = [load_edgetpu_delegate({'device': device} if device else {})]
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\pycoral\utils\edgetpu.py", line 52, in load_edgetpu_delegate
return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\tflite_runtime\interpreter.py", line 162, in load_delegate
raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from edgetpu.dll

I have installed edge tpu runtime - edgetpu_runtime_20210119.zip
I am working on windows10. I have uninstalled previous version of edge tpu before installing this.

I think this has become a common isuue. I kindly request you to help all of us with this issue! Thank you! :)

@hjonnala
Copy link
Contributor

hjonnala commented Aug 6, 2021

@AkkiSony can you paste the output of following command.

python3 -c 'from pycoral.utils.edgetpu import get_runtime_version; print(get_runtime_version())'

Please check if you have edgetpu.dll in this path C:\Windows\System32?
Please consider trying on personal laptop, that would help you to resolve the issues with organization laptop.

@AkkiSony
Copy link

AkkiSony commented Aug 9, 2021

python3 -c 'from pycoral.utils.edgetpu import get_runtime_version; print(get_runtime_version())'

python -c 'from pycoral.utils.edgetpu import get_runtime_version; print(get_runtime_version())'
BuildLabel(COMPILER=MSVC 192628805,DATE=Nov 4 2020,TIME=11:06:09), RuntimeVersion(13)
(coral_env)

Please check if you have edgetpu.dll in this path C:\Windows\System32?

coral-TPU-error-15

@AkkiSony
Copy link

AkkiSony commented Aug 9, 2021

python3 -c 'from pycoral.utils.edgetpu import get_runtime_version; print(get_runtime_version())'

@hjonnala It's strange that I am getting this output now.

python -c 'from pycoral.utils.edgetpu import get_runtime_version; print(get_runtime_version())'
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\asdf\Coral-USB\coral1\pycoral\pycoral\utils\edgetpu.py", line 24, in
from pycoral.pybind._pywrap_coral import GetRuntimeVersion as get_runtime_version
ModuleNotFoundError: No module named 'pycoral.pybind'
(coral_env)

@hjonnala
Copy link
Contributor

hjonnala commented Aug 9, 2021

@AkkiSony pycoral modules are fetching from this path C:\Users\asdf\Coral-USB\coral1\pycoral\pycoral\utils\edgetpu.py.. But they need to come from coral_env/lib/site-packages/pycoral..

@AkkiSony
Copy link

AkkiSony commented Aug 9, 2021

@hjonnala Do you have any idea what modification should I do?

@hjonnala
Copy link
Contributor

hjonnala commented Aug 9, 2021

@AkkiSony you can try renaming pycoral to pycoral1 or something else in coral1 directory..

@AkkiSony
Copy link

AkkiSony commented Aug 9, 2021

It dint work even after renaming! :/ @hjonnala

@hjonnala
Copy link
Contributor

hjonnala commented Aug 9, 2021

@AkkiSony please paste the error you are getting after renaming.

@AkkiSony
Copy link

AkkiSony commented Aug 9, 2021

$ python -c 'from pycoral.utils.edgetpu import get_runtime_version; print(get_runtime_version())'
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\asdf\Coral-USB\coral1\pycoral1\pycoral\utils\edgetpu.py", line 24, in
from pycoral.pybind._pywrap_coral import GetRuntimeVersion as get_runtime_version
ModuleNotFoundError: No module named 'pycoral.pybind'
(coral_env)

@hjonnala

@hjonnala
Copy link
Contributor

hjonnala commented Aug 9, 2021

@AkkiSony please change pycoral name also inside pycoral1 directory

@AkkiSony
Copy link

AkkiSony commented Aug 9, 2021

After renaming it, I got the following output.

BuildLabel(COMPILER=MSVC 192628805,DATE=Nov 4 2020,TIME=11:06:09), RuntimeVersion(13)

When I run the example code, I get the following error.
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\tflite_runtime\interpreter.py", line 160, in load_delegate
delegate = Delegate(library, options)
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\tflite_runtime\interpreter.py", line 119, in init
raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "examples/classify_image.py", line 85, in
main()
File "examples/classify_image.py", line 62, in main
interpreter = make_interpreter(*args.model.split('@'))
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\pycoral\utils\edgetpu.py", line 87, in make_interpreter
delegates = [load_edgetpu_delegate({'device': device} if device else {})]
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\pycoral\utils\edgetpu.py", line 52, in load_edgetpu_delegate
return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
File "C:\Users\asdf\Anaconda3\envs\coral_env\lib\site-packages\tflite_runtime\interpreter.py", line 162, in load_delegate
raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from edgetpu.dll


@hjonnala
Copy link
Contributor

hjonnala commented Aug 9, 2021

@AkkiSony It should be working fine with runtime version 13. Please make sure USB accelerator connected to the machine.

@AkkiSony
Copy link

AkkiSony commented Aug 9, 2021

Thanks. I am getting this error when the USB accelerator is connected. Is there a way where I can explicitly mention the location of .dll file and avoid this error? @hjonnala

@asylunatic
Copy link
Author

@hjonnala I uninstalled the latest version and installed edgetpu_runtime_20210119.zip as you recommended and it runs now! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hardware:USB Accelerator Coral USB Accelerator issues stat:awaiting response Status - Awaiting response from author subtype:windows Windos Build/installation issues type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

5 participants