"file too short" error when importing cv2 in container. Jetpack 5.1 and l4t-ml:r35.2.1-py3

Hello. I flashed my AGX Orin with Jetpack 5.1 rev 1 and DeepStream 6.2 (and all the Runtime and SDK components). And without updating or upgrading anything, I pulled the docker image l4t-ml:r35.2.1-py3.

Then, inside the container, I get this error when I try to import cv2 in python3:

>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/cv2/__init__.py", line 96, in <module>
    bootstrap()
  File "/usr/local/lib/python3.8/dist-packages/cv2/__init__.py", line 86, in bootstrap
    import cv2
ImportError: /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0: file too short

Hi @camilo2, did you start the container with --runtime nvidia? libgstreamer.so is one of the files that still gets mounted from the host device in /etc/nvidia-container-runtime/host-files-for-container.d/l4t.csv when the nvidia runtime is used. I just double-checked this container and was able to import cv2 okay.

Yes!, it was effectively the problem. Thanks!

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