Mediapipe error Open Gl error in myservice.service

Hello all, could someone help me? I have an issue, and searched a lots, but couldn’t find the solution. The issue: I try to run python code with hand_tracking_module on my NVIDIA Jetson Nano board with openCV and Mediapipe. When I run it via terminal or in VSCode work perfect, but when I run it vie myscript.script file in /etc/systemd/system/myservice.service it give errors(I put in commenters ,also the picture).It give same error, when I run vie ssh from my computer. I thing it is something with permission or access to GPU or something like this, but cant find where is or what I have to do. Thank you very much!

The ERROR:

[libprotobuf WARNING external/com_google_protobuf/src/google/protobuf/text_format.cc:324] Warning parsing text-format mediapipe.CalculatorGraphConfig: 125:5: text format contains deprecated field “use_gpu”
WARNING: Logging before InitGoogleLogging() is written to STDERR
I20220123 17:58:16.042357 19329 gl_context_egl.cc:163] Successfully initialized EGL. Major : 1 Minor: 5
W20220123 17:58:16.042462 19329 gl_context_egl.cc:168] Creating a context with OpenGL ES 3 failed: UNKNOWN: ; eglChooseConfig() returned no matching EGL configuration for RGBA8888 D16 ES3 request.
W20220123 17:58:16.042490 19329 gl_context_egl.cc:169] Fall back on OpenGL ES 2.
Traceback (most recent call last):
File “/home/nanorobo/Desktop/Python_projects/autostart.py”, line 240, in
hands = mpHands.Hands()
File “/usr/local/lib/python3.6/dist-packages/mediapipe/python/solutions/hands.py”, line 145, in init
outputs=[‘multi_hand_landmarks’, ‘multi_handedness’])
File “/usr/local/lib/python3.6/dist-packages/mediapipe/python/solution_base.py”, line 254, in init
self._graph.start_run(input_side_packets)
RuntimeError: ; eglChooseConfig() returned no matching EGL configuration for RGBA8888 D16 ES2 request.

SERVICE FILE:
[Unit]
Description=autoroboo: do my own thing
After=multi-user.target
After=graphical.target

[Service]
Type=simple
ExecStart= /usr/local/bin/autoroboo.sh
Restart=always
StartLimitInterval=10

RestartSec=10

RestartSec=1
Restart=on-failure
User=nanorobo
Group=nanorobo

[Install]
WantedBy=multi-user.target
WantedBy=sound.target
WantedBy=graphical.target

INFO FOR open GL:

name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA Tegra X1 (nvgpu)/integrated
OpenGL core profile version string: 4.6.0 NVIDIA 32.6.1
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 32.6.1
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 32.6.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

Hi,
We have tried to run application and gstreamer command in rc.local. Please refer to the topic and give it a try:
Autrun deepstream app at startup on jetson nano - #10 by DaneLLL
omxh264enc and nvvidconv NOT working unless... - #22 by DaneLLL

Hello, DaneLLL and Thank you very much for the answer! I read the articles and tried in rc-local today by the article info and I think this is not what I looking for. I forgot to write yesterday. I dont want to see what happen in front of my camera, I want the robot to see for the libraries and their work. I dont know if its different.I also use USB web cam. I tried this in /etc/rc.local, but givs only errors:

usr/bin/gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=300 ! video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY ! queue max-size-time=0 ! nvvidconv ! ‘video/x-raw(memory:NVMM)’ ! omxh264enc bitrate=5000000 ! video/x-h264 ! h264parse ! video/x-h264 ! queue ! flvmux name=mux streamable=true ! filesink location=/tmp/a.flv audiotestsrc num-buffers=500 ! queue ! audioconvert ! audioresample ! audio/x-raw,rate=44100 ! voaacenc bitrate=128000 ! audio/mpeg ! aacparse ! audio/mpeg, mpegversion=4 ! mux.

Hi,
The gstreamer commands should work since we have tried them. Probably your USB camera does not support 1920x1080p30 UYVY.

For the error:

RuntimeError: ; eglChooseConfig() returned no matching EGL configuration for RGBA8888 D16 ES2 request.

Are you able to share a test sample so that we can set up rc.local and run it in booting to reproduce the issue?

Hello, so the information about my issue:

  1. Jetson Nano 2GB
    2.USB CAM: OV3660 ATM

  2. Info for the cam:
    Driver Info (not using libv4l2):
    Driver name : uvcvideo
    Card type : Webcam
    Bus info : usb-70090000.xusb-3.1
    Driver version: 4.9.253
    Capabilities : 0x84200001
    Video Capture
    Streaming
    Extended Pix Format
    Device Capabilities
    Device Caps : 0x04200001
    Video Capture
    Streaming
    Extended Pix Format
    Priority: 2
    Video input : 0 (Camera 1: ok)
    Format Video Capture:
    Width/Height : 1920/1080
    Pixel Format : ‘MJPG’
    Field : None
    Bytes per Line : 0
    Size Image : 4147789
    Colorspace : Default
    Transfer Function : Default (maps to Rec. 709)
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)
    Quantization : Default (maps to Full Range)
    Flags :
    Crop Capability Video Capture:
    Bounds : Left 0, Top 0, Width 1920, Height 1080
    Default : Left 0, Top 0, Width 1920, Height 1080
    Pixel Aspect: 1/1
    Selection: crop_default, Left 0, Top 0, Width 1920, Height 1080
    Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1080
    Streaming Parameters Video Capture:
    Capabilities : timeperframe
    Frames per second: 25.000 (25/1)
    Read buffers : 0
    brightness 0x00980900 (int) : min=-64 max=64 step=1 default=0 value=0
    contrast 0x00980901 (int) : min=0 max=64 step=1 default=32 value=32
    saturation 0x00980902 (int) : min=1 max=128 step=1 default=64 value=64
    hue 0x00980903 (int) : min=-40 max=40 step=1 default=0 value=0
    white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
    gamma 0x00980910 (int) : min=72 max=500 step=1 default=100 value=100
    gain 0x00980913 (int) : min=0 max=100 step=1 default=0 value=0
    power_line_frequency 0x00980918 (menu) : min=0 max=2 default=1 value=1
    white_balance_temperature 0x0098091a (int) : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive
    sharpness 0x0098091b (int) : min=0 max=6 step=1 default=5 value=5
    backlight_compensation 0x0098091c (int) : min=0 max=2 step=1 default=1 value=1
    exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=3
    exposure_absolute 0x009a0902 (int) : min=1 max=5000 step=1 default=625 value=625 flags=inactive
    exposure_auto_priority 0x009a0903 (bool) : default=0 value=1

  3. cat /etc/rc.local:
    #! /bin/bash
    /usr/bin/python3 /home/nanorobo/Desktop/Python_projects/autostart.py

  4. cat /etc/systemd/system/rc_local.service:
    [Unit]
    Description=/etc/rc.local Compatibility
    ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

  1. I followed the instruction from this link:
    How to Enable /etc/rc.local with Systemd - LinuxBabe

  2. sudo systemctl status rc_local.service:

● rc_local.service - /etc/rc.local Compatibility
Loaded: loaded (/etc/systemd/system/rc_local.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-01-25 09:47:37 EET; 10s ago
Process: 9875 ExecStart=/etc/rc.local start (code=exited, status=203/EXEC)

яну 25 09:47:37 nanorobo-desktop systemd[1]: Starting /etc/rc.local Compatibility…
яну 25 09:47:37 nanorobo-desktop systemd[9875]: rc_local.service: Failed to execute command: Permission denied
яну 25 09:47:37 nanorobo-desktop systemd[9875]: rc_local.service: Failed at step EXEC spawning /etc/rc.local: Permission denied
яну 25 09:47:37 nanorobo-desktop systemd[1]: rc_local.service: Control process exited, code=exited status=203
яну 25 09:47:37 nanorobo-desktop systemd[1]: rc_local.service: Failed with result ‘exit-code’.
яну 25 09:47:37 nanorobo-desktop systemd[1]: Failed to start /etc/rc.local Compatibility.

Do you need something more?

Hi,
Please simplify autostart.py into a simple test sample and attach it. So that we can set up and run the script to reproduce the issue. Or please check if either sample in

/usr/src/nvidia/graphics_demos/

can be used to reproduce the issue.

We would need a way to reproduce it locally so that can check with our teams.

Hello, I am sorry, I forgot to attach it>
This is the content of autostart.py:
(basic code to run just hand model)

import cv2
import mediapipe as mp
import time

cap = cv2.VideoCapture(1)

mpHands = mp.solutions.hands
hands = mpHands.Hands()
mpDraw = mp.solutions.drawing_utils

pTime = 0
cTime = 0

while True:
    success, img = cap.read()
    imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    results = hands.process(imgRGB)
    # print(results.multi_hand_landmarks)

    if results.multi_hand_landmarks:
        for handLms in results.multi_hand_landmarks:
            for id, lm in enumerate(handLms.landmark):
                # print(id, lm)
                h, w, c = img.shape
                cx, cy = int(lm.x * w), int(lm.y * h)
                print(id, cx, cy)
                # if id == 4:
                cv2.circle(img, (cx, cy), 15, (255, 0, 255), cv2.FILLED)

            mpDraw.draw_landmarks(img, handLms, mpHands.HAND_CONNECTIONS)

    cTime = time.time()
    fps = 1 / (cTime - pTime)
    pTime = cTime

    cv2.putText(img, str(int(fps)), (10, 70), cv2.FONT_HERSHEY_PLAIN, 3,
                (255, 0, 255), 3)

    cv2.imshow("Image", img)
    cv2.waitKey(1)

Hello, DaneLLL! Did you made some tries with my case?

Hi,
It would need some time to set up and try. Woudl like to know:

  1. Does it run with a USB camera? Seems like there is a camera source since you call cv2.VideoCapture(1).
  2. So it fails in OpenCV code? From the description it seems to be an issue in OpenGL or EGL functions, such as eglChooseConfig(). But the sample is based on OpenCV.

Hello,

  1. Yes, it is with USB camera. The info about it is above in my commenters.
  2. I am not sure, what exactly is. My knowledges are not so deep , I am reading in google, but until now cant find the solution and where is the problem. I suppose it is from mediapipe condition for working well. Or this converting RGB to BGR or something with graphical permission for service file or something else.
    I run all, as I send as information here. Same files, same content.
    If I run the python file from my terminal or from my VSCode application, everything works fine. The problem may by came from the autoroboo.service file.

Hi,
Please put the commands to ~/.xsessionrc and give it a try. We have tried two commands which depend on X11 and it works:

/usr/bin/gst-launch-1.0 videotestsrc num-buffers=100 is-live=1 ! nvvidconv ! nvegltransform ! nveglglessink
/usr/bin/python /home/nvidia/camera.py

camera.py is this sample:
V4l2src using OpenCV Gstreamer is not working in Jetson Xavier NX - #3 by DaneLLL

Hello. Thank you very much for the answer! Could you tell me, where should be the directory of this file “~/.xsessionrc” ?

Hi,
The file is in your home directory like:

/home/_USER_NAME_/.xsessionrc

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.