Hi,
You will need a dev container to get the CUDA header and compiler.
For example:
diff --git a/Dockerfile b/Dockerfile
index 52f5b85..815a4ea 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,10 @@
-FROM nvcr.io/nvidia/deepstream-l4t:6.2-samples
-
+#FROM nvcr.io/nvidia/deepstream-l4t:6.2-samples
+FROM nvcr.io/nvidia/l4t-cuda:11.4.19-devel
# Usefull tools, apps and libraries
RUN apt-get update && apt install -y \
g++ gcc git automake \
ffmpeg wget sudo htop x11-apps nano xonsh \
- libopenmpt-dev python3-pip python3-gi
+ libopenmpt-dev python3-pip python3-gi unzip
RUN useradd -ms /bin/bash -G sudo,audio,video,render myuser && echo "myuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ubuntu
ENV TERM=xterm-256color
Not sure why the import fails in the Dockerfile.
But when you launching the container, the same command works well without issues.
$ sudo docker run -it --rm --runtime nvidia 3a3f8372ef53
==========
== CUDA ==
==========
...
myuser@24da2cd41af6:~$ python3 -c "import cv2; print(cv2.getBuildInformation())" | grep CUDA
NVIDIA CUDA: YES (ver 11.4, CUFFT CUBLAS)
Thanks.