How to uninstall opencv without uninstalling nvidia jetpack?

Libraries versions:

nvidia jetpack
nvidia-jetpack-dev/stable,now 5.1-b147 arm64 [installed]
nvidia-jetpack-runtime/stable,now 5.1-b147 arm64 [installed]
nvidia-jetpack/stable,now 5.1-b147 arm64 [installed]

libopencv-dev/stable,now 4.5.4-8-g3e4c170df4 arm64 [installed,automatic]
libopencv-python/stable,now 4.5.4-8-g3e4c170df4 arm64 [installed,automatic]
libopencv-samples/stable,now 4.5.4-8-g3e4c170df4 arm64 [installed,automatic]
libopencv/stable,now 4.5.4-8-g3e4c170df4 arm64 [installed,automatic]
nvidia-opencv-dev/stable,now 5.1-b147 arm64 [installed,automatic]
nvidia-opencv/stable,now 5.1-b147 arm64 [installed,automatic]
opencv-licenses/stable,now 4.5.4-8-g3e4c170df4 arm64 [installed,automatic]

Ubuntu 20.04.6 LTS 64 bit

Why do I need to uninstall opencv that came preinstalled on with nvidia Jetpack?

  File "/media/$USER/9C33-6BBD/yolov5/utils/", line 472, in __next__
    if not all(x.is_alive() for x in self.threads) or cv2.waitKey(1) == ord("q"):  # q to quit
cv2.error: OpenCV(4.8.0) /io/opencv/modules/highgui/src/window.cpp:1338: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'

I was trying to run yolov5 webcam detections, but the opencv is built without libgtk and I can’t see the windows.

What is stopping me from uninstalling the opencv ?

→ sudo apt purge libopencv-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gdal-data gir1.2-gst-plugins-bad-1.0 gstreamer1.0-gtk3 libabw-0.1-1 libarmadillo9 libarpack2 libboost-locale1.71.0 libcdr-0.1-1 libcfitsio8 libcharls2 libclucene-contribs1v5
  libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libcurl4-gnutls-dev libdap25 libdapclient6v5 libe-book-0.1-1 libeot0 libepsilon1 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0
  libexttextcat-data libfreehand-0.1-1 libfreexl1 libfyba0 libgdal26 libgdcm3.0 libgeos-3.8.0 libgeos-c1v5 libgeotiff5 libgl2ps1.4 libgpgmepp6 libhdf4-0-alt libhdf4-alt-dev
  libhdf5-openmpi-103 libjuh-java libjurt-java libkmlbase1 libkmldom1 libkmlengine1 liblangtag-common liblangtag1 liblept5 libmessaging-menu0 libmhash2 libminizip1 libmspub-0.1-1
  libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnetcdf-c++4 libnetcdf-dev libnetcdf15 libodfgen-0.1-1 libogdi4.1 liborcus-0.15-0 libpagemaker-0.0-0 libqhull7 libraptor2-0 librasqal3
  librdf0 librevenge-0.0-0 libridl-java libsocket++1 libspatialite7 libsuitesparseconfig5 libsuperlu5 libtesseract4 libuno-cppu3 libuno-cppuhelpergcc3-3 libuno-purpenvhelpergcc3-3
  libuno-sal3 libuno-salhelpergcc3-3 libunoloader-java liburiparser1 libvisio-0.1-1 libvtk6.3 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxerces-c3.2 libxmlsec1 libxmlsec1-nss libyajl2
  lp-solve odbcinst odbcinst1debian2 uno-libs-private ure
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  libopencv-dev* nvidia-jetpack* nvidia-jetpack-dev* nvidia-opencv-dev*
0 upgraded, 0 newly installed, 4 to remove and 4 not upgraded.
After this operation, 7,084 kB disk space will be freed.

As you can see nvidia-jetpack nvidia-jetpack-dev would also be uninstalled along with libopencv


  1. Can I only uninstall opencv from my AGX orin without removing other nvidia jetpack components?
  2. If I cannot (1), can I reinstall selected components without installing opencv after I’ve built my own version from source and other libraries included?

Please try this command:
JEP/script/ at master · AastaNV/JEP · GitHub

sudo apt -y purge libopencv