Error installing OpenCV on Nvidia Jetson

Hello all, I am trying to install a more up-to-date version of OpenCV. I am running into some trouble. It was saying that there are some broken packages that I need to repair first. I tried running the command to fix it but then I get errors about not being able to process and no package found even though it is able to download it… I am not too sure what is happening or why I am getting those errors. Could I get someone to read through what is happening and suggest some fixes? I think it might be related to out-of-date graphics drivers but again not completely sure

sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  apt-clone archdetect-deb bogl-bterm busybox-static cryptsetup-bin dpkg-repack efibootmgr gir1.2-timezonemap-1.0 gir1.2-xkl-1.0
  grub-common kde-window-manager kinit kio kpackagetool5 kwayland-data kwin-common kwin-data kwin-x11 libdebian-installer4
  libkdecorations2-5v5 libkdecorations2private5v5 libkf5activities5 libkf5attica5 libkf5completion-data libkf5completion5
  libkf5declarative-data libkf5declarative5 libkf5doctools5 libkf5globalaccel-data libkf5globalaccel5 libkf5globalaccelprivate5
  libkf5idletime5 libkf5jobwidgets-data libkf5jobwidgets5 libkf5kcmutils-data libkf5kcmutils5 libkf5kiocore5 libkf5kiontlm5
  libkf5kiowidgets5 libkf5newstuff-data libkf5newstuff5 libkf5newstuffcore5 libkf5package-data libkf5package5 libkf5plasma5
  libkf5quickaddons5 libkf5solid5 libkf5solid5-data libkf5sonnet5-data libkf5sonnetcore5 libkf5sonnetui5 libkf5textwidgets-data
  libkf5textwidgets5 libkf5waylandclient5 libkf5waylandserver5 libkf5xmlgui-bin libkf5xmlgui-data libkf5xmlgui5 libkscreenlocker5
  libkwin4-effect-builtins1 libkwineffects11 libkwinglutils11 libkwinxrenderutils11 libqgsttools-p1 libqt5multimedia5
  libqt5multimedia5-plugins libqt5multimediaquick-p5 libqt5multimediawidgets5 libxcb-composite0 libxcb-cursor0 libxcb-damage0
  os-prober python3-dbus.mainloop.pyqt5 python3-icu python3-pam python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebkit
  qml-module-org-kde-kquickcontrolsaddons qml-module-qtmultimedia qml-module-qtquick2 rdate tasksel tasksel-data
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libnvidia-compute-510 libnvidia-gl-510
The following NEW packages will be installed:
  libnvidia-compute-510 libnvidia-gl-510
0 upgraded, 2 newly installed, 0 to remove and 40 not upgraded.
24 not fully installed or removed.
Need to get 156 MB of archives.
After this operation, 384 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/sbsa  libnvidia-compute-510 510.85.02-0ubuntu1 [16.8 MB]
Get:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/sbsa  libnvidia-gl-510 510.85.02-0ubuntu1 [140 MB]          
Fetched 156 MB in 2min 2s (1,277 kB/s)                                                                                                
(Reading database ... 216778 files and directories currently installed.)
Preparing to unpack .../libnvidia-compute-510_510.85.02-0ubuntu1_arm64.deb ...
Unpacking libnvidia-compute-510:arm64 (510.85.02-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libnvidia-compute-510_510.85.02-0ubuntu1_arm64.deb (--unpack):
 trying to overwrite '/usr/lib/aarch64-linux-gnu/libcuda.so', which is also in package nvidia-l4t-cuda 32.7.4-20230608212426
Preparing to unpack .../libnvidia-gl-510_510.85.02-0ubuntu1_arm64.deb ...
dpkg-query: no packages found matching libnvidia-gl-450
Unpacking libnvidia-gl-510:arm64 (510.85.02-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libnvidia-gl-510_510.85.02-0ubuntu1_arm64.deb (--unpack):
 trying to overwrite '/usr/share/glvnd/egl_vendor.d/10_nvidia.json', which is also in package nvidia-l4t-3d-core 32.7.4-20230608212426
Errors were encountered while processing:
 /var/cache/apt/archives/libnvidia-compute-510_510.85.02-0ubuntu1_arm64.deb
 /var/cache/apt/archives/libnvidia-gl-510_510.85.02-0ubuntu1_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Hi,
We would suggest try previous versions of OpenCV. A user has shared a script for Jetson Nano:

GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

Please check and give it a try.

Hello all,

Sorry for going dark for so long. I ran the script and I still got the error. This is my output:

Installing build dependencies.
Get:1 file:/var/cuda-repo-l4t-10-2-local  InRelease
Ign:1 file:/var/cuda-repo-l4t-10-2-local  InRelease
Get:2 file:/var/visionworks-repo  InRelease
Ign:2 file:/var/visionworks-repo  InRelease
Get:3 file:/var/visionworks-sfm-repo  InRelease
Ign:3 file:/var/visionworks-sfm-repo  InRelease
Get:4 file:/var/visionworks-tracking-repo  InRelease
Ign:4 file:/var/visionworks-tracking-repo  InRelease
Get:5 file:/var/cuda-repo-l4t-10-2-local  Release [564 B]
Get:5 file:/var/cuda-repo-l4t-10-2-local  Release [564 B]
Get:6 file:/var/visionworks-repo  Release [2,001 B]
Get:6 file:/var/visionworks-repo  Release [2,001 B]
Get:7 file:/var/visionworks-sfm-repo  Release [2,005 B]                  
Get:7 file:/var/visionworks-sfm-repo  Release [2,005 B]                        
Get:8 file:/var/visionworks-tracking-repo  Release [2,010 B]             
Get:8 file:/var/visionworks-tracking-repo  Release [2,010 B]                   
Hit:9 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/sbsa  InRelease
Hit:10 https://repo.download.nvidia.com/jetson/common r32.7 InRelease          
Hit:12 https://repo.download.nvidia.com/jetson/t210 r32.7 InRelease            
Hit:13 http://ports.ubuntu.com/ubuntu-ports bionic InRelease                   
Hit:14 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease         
Get:15 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [102 kB]  
Hit:18 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease         
Hit:19 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease          
Get:21 https://packages.microsoft.com/repos/code stable InRelease [3,590 B]    
Get:22 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 Packages [1,846 kB]
Get:23 https://packages.microsoft.com/repos/code stable/main armhf Packages [18.9 kB]
Get:24 https://packages.microsoft.com/repos/code stable/main amd64 Packages [18.8 kB]
Get:25 https://packages.microsoft.com/repos/code stable/main arm64 Packages [18.8 kB]
Fetched 2,008 kB in 6s (311 kB/s)                                              
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda-drivers-510 : Depends: libnvidia-compute-510 (>= 510.85.02) but it is not installed
                    Depends: libnvidia-gl-510 (>= 510.85.02) but it is not installed
 libnvidia-decode-510 : Depends: libnvidia-compute-510 (= 510.85.02-0ubuntu1) but it is not installed
 nvidia-compute-utils-510 : Depends: libnvidia-compute-510 but it is not installed
 nvidia-driver-510 : Depends: libnvidia-gl-510 (= 510.85.02-0ubuntu1) but it is not installed
                     Depends: libnvidia-compute-510 (= 510.85.02-0ubuntu1) but it is not installed
 nvidia-utils-510 : Depends: libnvidia-compute-510 but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Ok so this is a big problem. I can’t install anything on my board. I am trying to install CUPS but it fails!

sudo apt install cups
[sudo] password for rgadmin: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda-drivers-510 : Depends: libnvidia-compute-510 (>= 510.85.02) but it is not going to be installed
                    Depends: libnvidia-gl-510 (>= 510.85.02) but it is not going to be installed
 cups : Depends: libcupscgi1 (>= 1.4.2) but it is not going to be installed
        Depends: libcupsmime1 (>= 1.4.0) but it is not going to be installed
        Depends: libcupsppdc1 (>= 1.4.0) but it is not going to be installed
        Depends: cups-core-drivers (>= 2.2.7-1ubuntu2.10) but it is not going to be installed
        Depends: cups-daemon (>= 2.2.7-1ubuntu2.10) but it is not going to be installed
        Depends: cups-common (>= 2.2.7-1ubuntu2.10) but it is not going to be installed
        Depends: cups-server-common (>= 2.2.7-1ubuntu2.10) but it is not going to be installed
        Depends: cups-client (>= 2.2.7-1ubuntu2.10) but it is not going to be installed
        Depends: cups-ppdc but it is not going to be installed
        Depends: cups-filters (>= 1.0.24-3~) but it is not going to be installed
        Recommends: cups-filters (>= 1.0.42) but it is not going to be installed or
                    foomatic-filters (>= 4.0)
        Recommends: printer-driver-gutenprint but it is not going to be installed
        Recommends: cups-filters (>= 1.0.36) but it is not going to be installed or
                    ghostscript-cups (>= 9.02~)
 libnvidia-decode-510 : Depends: libnvidia-compute-510 (= 510.85.02-0ubuntu1) but it is not going to be installed
 nvidia-compute-utils-510 : Depends: libnvidia-compute-510 but it is not going to be installed
 nvidia-driver-510 : Depends: libnvidia-gl-510 (= 510.85.02-0ubuntu1) but it is not going to be installed
                     Depends: libnvidia-compute-510 (= 510.85.02-0ubuntu1) but it is not going to be installed
 nvidia-utils-510 : Depends: libnvidia-compute-510 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I run the command it recommends and this is the output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  apt-clone archdetect-deb bogl-bterm busybox-static cryptsetup-bin
  dpkg-repack efibootmgr gir1.2-timezonemap-1.0 gir1.2-xkl-1.0 grub-common
  kde-window-manager kinit kio kpackagetool5 kwayland-data kwin-common
  kwin-data kwin-x11 libdebian-installer4 libkdecorations2-5v5
  libkdecorations2private5v5 libkf5activities5 libkf5attica5
  libkf5completion-data libkf5completion5 libkf5declarative-data
  libkf5declarative5 libkf5doctools5 libkf5globalaccel-data libkf5globalaccel5
  libkf5globalaccelprivate5 libkf5idletime5 libkf5jobwidgets-data
  libkf5jobwidgets5 libkf5kcmutils-data libkf5kcmutils5 libkf5kiocore5
  libkf5kiontlm5 libkf5kiowidgets5 libkf5newstuff-data libkf5newstuff5
  libkf5newstuffcore5 libkf5package-data libkf5package5 libkf5plasma5
  libkf5quickaddons5 libkf5solid5 libkf5solid5-data libkf5sonnet5-data
  libkf5sonnetcore5 libkf5sonnetui5 libkf5textwidgets-data libkf5textwidgets5
  libkf5waylandclient5 libkf5waylandserver5 libkf5xmlgui-bin libkf5xmlgui-data
  libkf5xmlgui5 libkscreenlocker5 libkwin4-effect-builtins1 libkwineffects11
  libkwinglutils11 libkwinxrenderutils11 libqgsttools-p1 libqt5multimedia5
  libqt5multimedia5-plugins libqt5multimediaquick-p5 libqt5multimediawidgets5
  libxcb-composite0 libxcb-cursor0 libxcb-damage0 os-prober
  python3-dbus.mainloop.pyqt5 python3-icu python3-pam python3-pyqt5
  python3-pyqt5.qtsvg python3-pyqt5.qtwebkit
  qml-module-org-kde-kquickcontrolsaddons qml-module-qtmultimedia
  qml-module-qtquick2 rdate tasksel tasksel-data
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libnvidia-compute-510 libnvidia-gl-510
The following NEW packages will be installed:
  libnvidia-compute-510 libnvidia-gl-510
0 upgraded, 2 newly installed, 0 to remove and 40 not upgraded.
24 not fully installed or removed.
Need to get 0 B/156 MB of archives.
After this operation, 384 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 216778 files and directories currently installed.)
Preparing to unpack .../libnvidia-compute-510_510.85.02-0ubuntu1_arm64.deb ...
Unpacking libnvidia-compute-510:arm64 (510.85.02-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libnvidia-compute-510_510.85.02-0ubuntu1_arm64.deb (--unpack):
 trying to overwrite '/usr/lib/aarch64-linux-gnu/libcuda.so', which is also in package nvidia-l4t-cuda 32.7.4-20230608212426
Preparing to unpack .../libnvidia-gl-510_510.85.02-0ubuntu1_arm64.deb ...
dpkg-query: no packages found matching libnvidia-gl-450
Unpacking libnvidia-gl-510:arm64 (510.85.02-0ubuntu1) ...

This is getting to become a serious problem on my end and need some help debugging the issue

Hi,
Your system seems to be in a unknown status. Would suggest re-flash to Jetpack 4.6.5 to have a clean system, and try again.

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