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

Error during the build step #5

Closed
StefanoGiu opened this issue Nov 8, 2023 · 21 comments
Closed

Error during the build step #5

StefanoGiu opened this issue Nov 8, 2023 · 21 comments

Comments

@StefanoGiu
Copy link

ERROR: /root/.cache/bazel/bazel_root/eab0d61a99b6696edb3d2aff87b585e8/external/ruy/ruy/BUILD:576:11: Compiling ruy/pack_arm.cc failed: (Exit 1): arm-linux-gnueabihf-gcc failed: error executing command
(cd /root/.cache/bazel/bazel_root/eab0d61a99b6696edb3d2aff87b585e8/sandbox/processwrapper-sandbox/1348/execroot/pycoral &&
exec env -
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PWD=/proc/self/cwd
/usr/bin/arm-linux-gnueabihf-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-march=armv7-a' '-mfpu=neon-vfpv4' -g0 -O3 -DNDEBUG '-D_FORTIFY_SOURCE=2' -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize '-std=c++14' -MD -MF bazel-out/armv7a-opt/bin/external/ruy/ruy/objs/pack_arm/pack_arm.d '-frandom-seed=bazel-out/armv7a-opt/bin/external/ruy/ruy/objs/pack_arm/pack_arm.o' -iquote external/ruy -iquote bazel-out/armv7a-opt/bin/external/ruy -iquote external/cpuinfo -iquote bazel-out/armv7a-opt/bin/external/cpuinfo -iquote external/clog -iquote bazel-out/armv7a-opt/bin/external/clog -Ibazel-out/armv7a-opt/bin/external/cpuinfo/virtual_includes/cpuinfo -Ibazel-out/armv7a-opt/bin/external/clog/virtual_includes/clog '-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION' '-ffp-contract=off' -Wall -Wextra -Wc++14-compat -Wundef '-mfpu=neon' -O3 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP="redacted"' '-D__TIME
="redacted"' -c external/ruy/ruy/pack_arm.cc -o bazel-out/armv7a-opt/bin/external/ruy/ruy/_objs/pack_arm/pack_arm.o)
Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox arm-linux-gnueabihf-gcc failed: error executing command
(cd /root/.cache/bazel/bazel_root/eab0d61a99b6696edb3d2aff87b585e8/sandbox/processwrapper-sandbox/1348/execroot/pycoral &&
exec env -
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PWD=/proc/self/cwd
/usr/bin/arm-linux-gnueabihf-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-march=armv7-a' '-mfpu=neon-vfpv4' -g0 -O3 -DNDEBUG '-D_FORTIFY_SOURCE=2' -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize '-std=c++14' -MD -MF bazel-out/armv7a-opt/bin/external/ruy/ruy/objs/pack_arm/pack_arm.d '-frandom-seed=bazel-out/armv7a-opt/bin/external/ruy/ruy/objs/pack_arm/pack_arm.o' -iquote external/ruy -iquote bazel-out/armv7a-opt/bin/external/ruy -iquote external/cpuinfo -iquote bazel-out/armv7a-opt/bin/external/cpuinfo -iquote external/clog -iquote bazel-out/armv7a-opt/bin/external/clog -Ibazel-out/armv7a-opt/bin/external/cpuinfo/virtual_includes/cpuinfo -Ibazel-out/armv7a-opt/bin/external/clog/virtual_includes/clog '-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION' '-ffp-contract=off' -Wall -Wextra -Wc++14-compat -Wundef '-mfpu=neon' -O3 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP="redacted"' '-D__TIME
_="redacted"' -c external/ruy/ruy/pack_arm.cc -o bazel-out/armv7a-opt/bin/external/ruy/ruy/_objs/pack_arm/pack_arm.o)
Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/ruy/ruy/pack_arm.cc:16:
external/ruy/ruy/pack_arm.h:492:9: warning: multi-line comment [-Wcomment]
492 | #endif // (RUY_PLATFORM_NEON_64 || RUY_PLATFORM_NEON_32) && \

@oberluz
Copy link
Owner

oberluz commented Nov 8, 2023

I haven't provided armv7a wheels due to this issue which I reported 3 weeks ago: google/ruy#347

Your best bet is to clone tensorflow and try to build it for armv7a and when it fails raise an issue with the tensorflow project.

Or try to fix it in Ruy yourself ;)

@oberluz oberluz closed this as completed Nov 8, 2023
@StefanoGiu
Copy link
Author

I don't have an ARMv7 processor... I have an Intel i3 octacore... 64 bit... Why I enter into the ARMv7 path?

@oberluz
Copy link
Owner

oberluz commented Nov 8, 2023

Please paste the commands you are using to build it

@StefanoGiu
Copy link
Author

I tried both with scripts/build.sh and scripts/build_deb.sh.

I'm on Linux Mint 21

@oberluz
Copy link
Owner

oberluz commented Nov 8, 2023

Can you paste the command you are using?

If you are using just scripts/builds.sh then you will be building all python versions for all archs, including arm7a

@StefanoGiu
Copy link
Author

I'm using "scripts/build.sh"... this is the command... what shall I use?

@oberluz
Copy link
Owner

oberluz commented Nov 8, 2023 via email

@StefanoGiu
Copy link
Author

I'm on Python 3.10.12 and x86_64 arch.

@oberluz
Copy link
Owner

oberluz commented Nov 9, 2023

Why don't you use the wheels already provided in the releases?

$ python --version
Python 3.10.12

$ python3 -m pip install ~/Downloads/tflite_runtime-2.13.0-cp310-cp310-linux_x86_64.whl 
Defaulting to user installation because normal site-packages is not writeable
Processing /home/eyeot-demo/Downloads/tflite_runtime-2.13.0-cp310-cp310-linux_x86_64.whl
Requirement already satisfied: numpy>=1.16.0 in /usr/local/lib/python3.10/dist-packages (from tflite-runtime==2.13.0) (1.23.3)
Installing collected packages: tflite-runtime
Successfully installed tflite-runtime-2.13.0
                      
$ python3 -m pip install ~/Downloads/pycoral-2.13.0-cp310-cp310-linux_x86_64.whl 
Defaulting to user installation because normal site-packages is not writeable
Processing /home/eyeot-demo/Downloads/pycoral-2.13.0-cp310-cp310-linux_x86_64.whl
Requirement already satisfied: Pillow>=4.0.0 in /usr/local/lib/python3.10/dist-packages (from pycoral==2.13.0) (10.1.0)
Requirement already satisfied: numpy>=1.16.0 in /usr/local/lib/python3.10/dist-packages (from pycoral==2.13.0) (1.23.3)
Requirement already satisfied: tflite-runtime==2.13.0 in /home/eyeot-demo/.local/lib/python3.10/site-packages (from pycoral==2.13.0) (2.13.0)
Installing collected packages: pycoral
Successfully installed pycoral-2.13.0

You can build it yourself with:

$ git checkout 2_7_0 # or 2_14_0
$ git submodule update --init --recursive
$ DOCKER_CPUS=k8 scripts/build.sh --python_versions 310

Note in scripts/build.sh that 310 is built using ubuntu:22.04. If you get an error message when installing the wheels due to libc you could try changing ubuntu:22.04 to use a docker image for your linux mint release.

@StefanoGiu
Copy link
Author

Sorry, where can I get those whl files?

@oberluz
Copy link
Owner

oberluz commented Nov 9, 2023

Look in the main page on the right there is a link called releases.

It points to https://github.com/oberluz/pycoral/releases

@StefanoGiu
Copy link
Author

Thanks a lot!! I installed it, but now when I run:

root@ServerNVR:/home/stefano/coral/coral/pycoral# 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

I get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/tflite_runtime/interpreter.py", line 166, in load_delegate
delegate = Delegate(library, options)
File "/usr/local/lib/python3.10/dist-packages/tflite_runtime/interpreter.py", line 104, in init
raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/stefano/coral/coral/pycoral/examples/classify_image.py", line 121, in
main()
File "/home/stefano/coral/coral/pycoral/examples/classify_image.py", line 71, in main
interpreter = make_interpreter(*args.model.split('@'))
File "/usr/local/lib/python3.10/dist-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter
delegates = [load_edgetpu_delegate({'device': device} if device else {})]
File "/usr/local/lib/python3.10/dist-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate
return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
File "/usr/local/lib/python3.10/dist-packages/tflite_runtime/interpreter.py", line 168, in load_delegate
raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from libedgetpu.so.1

Can you help here?

@oberluz
Copy link
Owner

oberluz commented Nov 9, 2023

Paste the relevant code...

@StefanoGiu
Copy link
Author

@StefanoGiu
Copy link
Author

I'm trying to run:
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

@oberluz
Copy link
Owner

oberluz commented Nov 9, 2023

Did you plugin in your coral stick into the USB port?

I ran it without the coral and I got the same error:

eyeot-demo@eyeotdemo-ThinkPad-X380-Yoga:~/src/pycoral/tmp(2_7_0)$ python3.8 ../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
Traceback (most recent call last):
  File "/home/eyeot-demo/.local/lib/python3.8/site-packages/tflite_runtime/interpreter.py", line 182, in load_delegate
    delegate = Delegate(library, options)
  File "/home/eyeot-demo/.local/lib/python3.8/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 "../examples/classify_image.py", line 122, in <module>
    main()
  File "../examples/classify_image.py", line 72, in main
    interpreter = make_interpreter(*args.model.split('@'))
  File "/home/eyeot-demo/.local/lib/python3.8/site-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
  File "/home/eyeot-demo/.local/lib/python3.8/site-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
  File "/home/eyeot-demo/.local/lib/python3.8/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

I plugged it in and it works:

eyeot-demo@eyeotdemo-ThinkPad-X380-Yoga:~/src/pycoral/tmp(2_7_0)$ vi ../examples/classify_image.py
eyeot-demo@eyeotdemo-ThinkPad-X380-Yoga:~/src/pycoral/tmp(2_7_0)$ python3.8 ../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
----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
98.9ms
11.1ms
11.0ms
11.1ms
11.1ms
-------RESULTS--------
Ara macao (Scarlet Macaw): 0.75781
eyeot-demo@eyeotdemo-ThinkPad-X380-Yoga:~/src/pycoral/tmp(2_7_0)$ 

@StefanoGiu
Copy link
Author

Yes, it's plugged in, but used by Frigate in a container. Maybe Frigate is locking the USB Coral somehow?

@StefanoGiu
Copy link
Author

Any idea? The issue seems to be intermittent and sometimes I get a segmentation fault... with a core dump!

@StefanoGiu
Copy link
Author

I tried to stop Frigate, but the issue is still there...

@oberluz
Copy link
Owner

oberluz commented Nov 11, 2023 via email

@StefanoGiu
Copy link
Author

I tried outside Frigate container... it's the same...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants