OpenGL error when trying object detection image viewer sample

I am trying to run the object detection image viewer sample included with the installation of the SDK.

The first time i tried to run it it didn’t find the OpenGL module, so I installed it with pip.

After this, I got the following error:

OpenGL.error.Error: Attempt to retrieve context when no valid context

What am I missing?

Thank you all in advance!

Edit:
This is the whole output, it shows a cuDNN error too…

(venv1) martin@martin-ubuntu:~/Desktop/python$ python3 object_detection_image_viewer.py --input_svo_file filare.svo2
}[Sample] Using SVO File input: filare.svo2
[Sample] Using default resolution
[2024-12-11 11:14:08 UTC][ZED][INFO] Logging level INFO
[2024-12-11 11:14:08 UTC][ZED][INFO] Logging level INFO
[2024-12-11 11:14:08 UTC][ZED][INFO] Logging level INFO
[2024-12-11 11:14:10 UTC][ZED][INFO] [Init] Depth mode: PERFORMANCE
[2024-12-11 11:14:10 UTC][ZED][INFO] [Init] Serial Number: S/N 26962166
[2024-12-11 11:14:11 UTC][ZED][ERROR] [Object Detection] cuDNN library not found
[2024-12-11 11:14:11 UTC][ZED][ERROR] [ZED] [Object Detection] CUDNN NOT FOUND
[2024-12-11 11:14:11 UTC][ZED][WARNING] CORRUPTED SDK INSTALLATION in sl::ERROR_CODE sl::camera::enableObjectDetection(sl::ObjectDetectionParameters)
Traceback (most recent call last):
File “/home/martin/Desktop/python/object_detection_image_viewer.py”, line 145, in
main()
^^^^^^
File “/home/martin/Desktop/python/object_detection_image_viewer.py”, line 102, in main
viewer.init(camera_info.camera_configuration.calibration_parameters.left_cam, obj_param.enable_tracking)
File “/home/martin/Desktop/python/ogl_viewer/viewer.py”, line 549, in init
glutDisplayFunc(self.draw_callback)
File “/home/martin/directory_env/venv1/lib/python3.12/site-packages/OpenGL/GLUT/special.py”, line 147, in call
contextdata.setValue( self.CONTEXT_DATA_KEY, cCallback )
File “/home/martin/directory_env/venv1/lib/python3.12/site-packages/OpenGL/contextdata.py”, line 58, in setValue
context = getContext( context )
^^^^^^^^^^^^^^^^^^^^^
File “/home/martin/directory_env/venv1/lib/python3.12/site-packages/OpenGL/contextdata.py”, line 40, in getContext
raise error.Error(
OpenGL.error.Error: Attempt to retrieve context when no valid context

Hi @MartinEsche,

Can you run the ZED_Diagnostic tool and send the resulting JSON file? This will help troubleshoot for your system.

Additionally, can you confirm that you are running the sample with a screen connected to your graphics card? Not with a remote ssh connection for example

Hi @mattrouss,

I am running the sample on my laptot using a GTX 1050 Ti, I guess the screen is correctly connected to the graphics card.

I managed to solve the cuDNN problem by doing a clean reinstall of ubuntu, Zed SDK and nvidia drivers (I just installed cuda 12 and not the cuda toolkit). I am still crushing against the “no valid context” error.

Sadly I cannot upload the json file, since I am a new user and I am not allowed to upload attachments.

Thanks for your answer!

Update: I followed this support page and got the following output:

martin@martin-ubuntu:~$ glxinfo | grep OpenGL
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CFL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.2.3-1ubuntu1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.2.3-1ubuntu1
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.2.3-1ubuntu1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

How can I get OpenGL to recognise the NVIDIA GPU card instead of the Intel one?