0

The hassle of installing OpenCV on Raspbian is something many want to avoid, and the easiest way to do this is to use a prebuilt image. I decided to take this route, only to find most pre-built images are still running outdated OS builds, that don't support the pi-4.

My question is, weather anyone knows of an updated image, or can provide one.

After trying solutions including ingo's, I encountered this error.

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  adwaita-icon-theme at-spi2-core autoconf automake autotools-dev
  dbus-user-session dconf-gsettings-backend dconf-service fontconfig
  fontconfig-config fonts-dejavu-core gdal-data gfortran gfortran-8
  glib-networking glib-networking-common glib-networking-services
  gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme
  ibverbs-providers libaacs0 libaec0 libaom0 libarmadillo9 libarpack2
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3
  libavcodec58 libavformat58 libavresample4 libavutil56 libbdplus0 libblas3
  libbluray2 libcaf-openmpi-3 libcairo-gobject2 libcairo2 libcharls2
  libchromaprint1 libcoarrays-dev libcoarrays-openmpi-dev libcodec2-0.8.1
  libcolord2 libcroco3 libcups2 libcurl3-gnutls libdap25 libdapclient6v5
  libdapserver7v5 libdatrie1 libdc1394-22 libdconf1 libdrm-common
  libdrm-etnaviv1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libepoxy0 libepsilon1
  libevent-core-2.1-6 libevent-pthreads-2.1-6 libexif12 libfontconfig1
  libfreexl1 libfyba0 libgd3 libgdal20 libgdcm2.8 libgdk-pixbuf2.0-0
  libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgeos-3.7.1 libgeos-c1v5
  libgeotiff2 libgfortran-8-dev libgfortran5 libgif7 libgl1 libgl1-mesa-dri
  libgl2ps1.4 libglapi-mesa libglu1-mesa libglvnd0 libglx-mesa0 libglx0
  libgme0 libgphoto2-6 libgphoto2-l10n libgphoto2-port12 libgraphite2-3
  libgsm1 libgtk-3-0 libgtk-3-bin libgtk-3-common libharfbuzz0b libhdf4-0-alt
  libhdf5-103 libhdf5-openmpi-103 libhwloc-dev libhwloc-plugins libhwloc5
  libibverbs-dev libibverbs1 libice6 libilmbase23 libjbig0 libjson-glib-1.0-0
  libjson-glib-1.0-common libjsoncpp1 libkmlbase1 libkmlconvenience1
  libkmldom1 libkmlengine1 libkmlregionator1 libkmlxsd1 liblapack3 liblcms2-2
  liblept5 libllvm6.0 libltdl-dev libltdl7 libmariadb3 libminizip1 libmp3lame0
  libmpg123-0 libnetcdf-c++4 libnetcdf13 libnl-3-dev libnl-route-3-dev
  libnspr4 libnss3 libodbc1 libogdi3.2 libogg0 libopencv-calib3d3.2
  libopencv-contrib3.2 libopencv-core3.2 libopencv-features2d3.2
  libopencv-flann3.2 libopencv-highgui3.2 libopencv-imgcodecs3.2
  libopencv-imgproc3.2 libopencv-ml3.2 libopencv-objdetect3.2
  libopencv-photo3.2 libopencv-shape3.2 libopencv-stitching3.2
  libopencv-superres3.2 libopencv-video3.2 libopencv-videoio3.2
  libopencv-videostab3.2 libopencv-viz3.2 libopenexr23 libopenjp2-7
  libopenmpi-dev libopenmpi3 libopenmpt0 libopus0 libpango-1.0-0
  libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpixman-1-0 libpmix2
  libpoppler82 libpq5 libproj13 libproxy1v5 libpython2.7 libqhull7
  libraw1394-11 librest-0.7-0 librsvg2-2 librsvg2-common libsensors-config
  libsensors5 libshine3 libsigsegv2 libsm6 libsnappy1v5 libsocket++1
  libsoup-gnome2.4-1 libsoup2.4-1 libsoxr0 libspatialite7 libspeex1
  libssh-gcrypt-4 libsuperlu5 libswresample3 libswscale5 libsz2 libtbb2
  libtcl8.6 libtesseract4 libthai-data libthai0 libtheora0 libtiff5 libtk8.6
  libtool libtwolame0 liburiparser1 libva-drm2 libva-x11-2 libva2
  libvdpau-va-gl1 libvdpau1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx5
  libvtk6.3 libwavpack1 libwayland-client0 libwayland-cursor0 libwayland-egl1
  libwebp6 libwebpmux3 libx11-xcb1 libx264-155 libx265-165 libxcb-dri2-0
  libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0
  libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxdamage1
  libxerces-c3.2 libxfixes3 libxft2 libxi6 libxinerama1 libxkbcommon0 libxpm4
  libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxvidcore4
  libxxf86vm1 libzvbi-common libzvbi0 m4 mariadb-common mesa-va-drivers
  mesa-vdpau-drivers mysql-common ocl-icd-libopencl1 odbcinst odbcinst1debian2
  openmpi-bin openmpi-common poppler-data proj-bin proj-data python3-numpy
  va-driver-all vdpau-driver-all x11-common
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc gettext gfortran-doc
  gfortran-8-doc libgfortran5-dbg libbluray-bdj colord cups-common libgd-tools
  geotiff-bin gdal-bin libgeotiff-epsg gphoto2 gvfs libhdf4-doc
  libhdf4-alt-dev hdf4-tools libhwloc-contrib-plugins liblcms2-utils
  libtool-doc libmyodbc odbc-postgresql tdsodbc unixodbc-bin ogdi-bin
  openmpi-doc opus-tools pciutils libraw1394-doc librsvg2-bin lm-sensors speex
  tcl8.6 tk8.6 gcj-jdk mpi-default-bin vtk6-doc vtk6-examples m4-doc
  opencl-icd poppler-utils ghostscript fonts-japanese-mincho
  | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic
  fonts-arphic-ukai fonts-arphic-uming fonts-nanum python-numpy-doc
  python3-pytest python3-numpy-dbg
The following NEW packages will be installed:
  adwaita-icon-theme at-spi2-core autoconf automake autotools-dev
  dbus-user-session dconf-gsettings-backend dconf-service fontconfig
  fontconfig-config fonts-dejavu-core gdal-data gfortran gfortran-8
  glib-networking glib-networking-common glib-networking-services
  gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme
  ibverbs-providers libaacs0 libaec0 libaom0 libarmadillo9 libarpack2
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3
  libavcodec58 libavformat58 libavresample4 libavutil56 libbdplus0 libblas3
  libbluray2 libcaf-openmpi-3 libcairo-gobject2 libcairo2 libcharls2
  libchromaprint1 libcoarrays-dev libcoarrays-openmpi-dev libcodec2-0.8.1
  libcolord2 libcroco3 libcups2 libcurl3-gnutls libdap25 libdapclient6v5
  libdapserver7v5 libdatrie1 libdc1394-22 libdconf1 libdrm-common
  libdrm-etnaviv1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libepoxy0 libepsilon1
  libevent-core-2.1-6 libevent-pthreads-2.1-6 libexif12 libfontconfig1
  libfreexl1 libfyba0 libgd3 libgdal20 libgdcm2.8 libgdk-pixbuf2.0-0
  libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgeos-3.7.1 libgeos-c1v5
  libgeotiff2 libgfortran-8-dev libgfortran5 libgif7 libgl1 libgl1-mesa-dri
  libgl2ps1.4 libglapi-mesa libglu1-mesa libglvnd0 libglx-mesa0 libglx0
  libgme0 libgphoto2-6 libgphoto2-l10n libgphoto2-port12 libgraphite2-3
  libgsm1 libgtk-3-0 libgtk-3-bin libgtk-3-common libharfbuzz0b libhdf4-0-alt
  libhdf5-103 libhdf5-openmpi-103 libhwloc-dev libhwloc-plugins libhwloc5
  libibverbs-dev libibverbs1 libice6 libilmbase23 libjbig0 libjson-glib-1.0-0
  libjson-glib-1.0-common libjsoncpp1 libkmlbase1 libkmlconvenience1
  libkmldom1 libkmlengine1 libkmlregionator1 libkmlxsd1 liblapack3 liblcms2-2
  liblept5 libllvm6.0 libltdl-dev libltdl7 libmariadb3 libminizip1 libmp3lame0
  libmpg123-0 libnetcdf-c++4 libnetcdf13 libnl-3-dev libnl-route-3-dev
  libnspr4 libnss3 libodbc1 libogdi3.2 libogg0 libopencv-calib3d3.2
  libopencv-contrib3.2 libopencv-core3.2 libopencv-features2d3.2
  libopencv-flann3.2 libopencv-highgui3.2 libopencv-imgcodecs3.2
  libopencv-imgproc3.2 libopencv-ml3.2 libopencv-objdetect3.2
  libopencv-photo3.2 libopencv-shape3.2 libopencv-stitching3.2
  libopencv-superres3.2 libopencv-video3.2 libopencv-videoio3.2
  libopencv-videostab3.2 libopencv-viz3.2 libopenexr23 libopenjp2-7
  libopenmpi-dev libopenmpi3 libopenmpt0 libopus0 libpango-1.0-0
  libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpixman-1-0 libpmix2
  libpoppler82 libpq5 libproj13 libproxy1v5 libpython2.7 libqhull7
  libraw1394-11 librest-0.7-0 librsvg2-2 librsvg2-common libsensors-config
  libsensors5 libshine3 libsigsegv2 libsm6 libsnappy1v5 libsocket++1
  libsoup-gnome2.4-1 libsoup2.4-1 libsoxr0 libspatialite7 libspeex1
  libssh-gcrypt-4 libsuperlu5 libswresample3 libswscale5 libsz2 libtbb2
  libtcl8.6 libtesseract4 libthai-data libthai0 libtheora0 libtiff5 libtk8.6
  libtool libtwolame0 liburiparser1 libva-drm2 libva-x11-2 libva2
  libvdpau-va-gl1 libvdpau1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx5
  libvtk6.3 libwavpack1 libwayland-client0 libwayland-cursor0 libwayland-egl1
  libwebp6 libwebpmux3 libx11-xcb1 libx264-155 libx265-165 libxcb-dri2-0
  libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0
  libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxdamage1
  libxerces-c3.2 libxfixes3 libxft2 libxi6 libxinerama1 libxkbcommon0 libxpm4
  libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxvidcore4
  libxxf86vm1 libzvbi-common libzvbi0 m4 mariadb-common mesa-va-drivers
  mesa-vdpau-drivers mysql-common ocl-icd-libopencl1 odbcinst odbcinst1debian2
  openmpi-bin openmpi-common poppler-data proj-bin proj-data python3-numpy
  python3-opencv va-driver-all vdpau-driver-all x11-common
0 upgraded, 271 newly installed, 0 to remove and 0 not upgraded.
Need to get 431 kB/146 MB of archives.
After this operation, 860 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://raspbian.raspberrypi.org/raspbian buster/main armhf libpango-1.0-0                                                                                                              armhf 1.42.4-6
  404  Not Found [IP: 93.93.128.193 80]
Err:2 http://raspbian.raspberrypi.org/raspbian buster/main armhf libpangoft2-1.0                                                                                                             -0 armhf 1.42.4-6
  404  Not Found [IP: 93.93.128.193 80]
Err:3 http://raspbian.raspberrypi.org/raspbian buster/main armhf libpangocairo-1                                                                                                             .0-0 armhf 1.42.4-6
  404  Not Found [IP: 93.93.128.193 80]
Err:4 http://raspbian.raspberrypi.org/raspbian buster/main armhf libpq5 armhf 11                                                                                                             .4-1
  404  Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/p/pango1.0                                                                                                             /libpango-1.0-0_1.42.4-6_armhf.deb  404  Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/p/pango1.0                                                                                                             /libpangoft2-1.0-0_1.42.4-6_armhf.deb  404  Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/p/pango1.0                                                                                                             /libpangocairo-1.0-0_1.42.4-6_armhf.deb  404  Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/p/postgres                                                                                                             ql-11/libpq5_11.4-1_armhf.deb  404  Not Found [IP: 93.93.128.193 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-mis                                                                                                             sing?

The output of apt list *opencv* is :

Listing... Done
cl-opencv-apps/stable 1.12.0-2 all
gstreamer1.0-opencv/stable 1.14.4-1+b1 armhf
libgstreamer-opencv1.0-0/stable 1.14.4-1+b1 armhf
libopencv-apps-dev/stable 1.12.0-2 armhf
libopencv-apps1d/stable 1.12.0-2 armhf
libopencv-calib3d-dev/stable 3.2.0+dfsg-6 armhf
libopencv-calib3d3.2/stable 3.2.0+dfsg-6 armhf
libopencv-contrib-dev/stable 3.2.0+dfsg-6 armhf
libopencv-contrib3.2/stable 3.2.0+dfsg-6 armhf
libopencv-core-dev/stable 3.2.0+dfsg-6 armhf
libopencv-core3.2/stable 3.2.0+dfsg-6 armhf
libopencv-dev/stable 3.2.0+dfsg-6 armhf
libopencv-features2d-dev/stable 3.2.0+dfsg-6 armhf
libopencv-features2d3.2/stable 3.2.0+dfsg-6 armhf
libopencv-flann-dev/stable 3.2.0+dfsg-6 armhf
libopencv-flann3.2/stable 3.2.0+dfsg-6 armhf
libopencv-highgui-dev/stable 3.2.0+dfsg-6 armhf
libopencv-highgui3.2/stable 3.2.0+dfsg-6 armhf
libopencv-imgcodecs-dev/stable 3.2.0+dfsg-6 armhf
libopencv-imgcodecs3.2/stable 3.2.0+dfsg-6 armhf
libopencv-imgproc-dev/stable 3.2.0+dfsg-6 armhf
libopencv-imgproc3.2/stable 3.2.0+dfsg-6 armhf
libopencv-ml-dev/stable 3.2.0+dfsg-6 armhf
libopencv-ml3.2/stable 3.2.0+dfsg-6 armhf
libopencv-objdetect-dev/stable 3.2.0+dfsg-6 armhf
libopencv-objdetect3.2/stable 3.2.0+dfsg-6 armhf
libopencv-photo-dev/stable 3.2.0+dfsg-6 armhf
libopencv-photo3.2/stable 3.2.0+dfsg-6 armhf
libopencv-shape-dev/stable 3.2.0+dfsg-6 armhf
libopencv-shape3.2/stable 3.2.0+dfsg-6 armhf
libopencv-stitching-dev/stable 3.2.0+dfsg-6 armhf
libopencv-stitching3.2/stable 3.2.0+dfsg-6 armhf
libopencv-superres-dev/stable 3.2.0+dfsg-6 armhf
libopencv-superres3.2/stable 3.2.0+dfsg-6 armhf
libopencv-ts-dev/stable 3.2.0+dfsg-6 armhf
libopencv-video-dev/stable 3.2.0+dfsg-6 armhf
libopencv-video3.2/stable 3.2.0+dfsg-6 armhf
libopencv-videoio-dev/stable 3.2.0+dfsg-6 armhf
libopencv-videoio3.2/stable 3.2.0+dfsg-6 armhf
libopencv-videostab-dev/stable 3.2.0+dfsg-6 armhf
libopencv-videostab3.2/stable 3.2.0+dfsg-6 armhf
libopencv-viz-dev/stable 3.2.0+dfsg-6 armhf
libopencv-viz3.2/stable 3.2.0+dfsg-6 armhf
libopencv3.2-java/stable 3.2.0+dfsg-6 all
libopencv3.2-jni/stable 3.2.0+dfsg-6 armhf
node-opencv/stable 6.0.0+git20180416.cfc96ba0-3 armhf
opencv-data/stable 3.2.0+dfsg-6 all
opencv-doc/stable 3.2.0+dfsg-6 all
python-opencv-apps/stable 1.12.0-2 all
python-opencv/stable 3.2.0+dfsg-6 armhf
python3-opencv-apps/stable 1.12.0-2 all
python3-opencv/stable 3.2.0+dfsg-6 armhf
ros-opencv-apps/stable 1.12.0-2 armhf

My pi has internet as I'm posting this post via the same network as the pi, using ssh to execute the commands. My ping Ability is :

PING google.com (216.58.210.206) 56(84) bytes of data.
64 bytes from lhr48s11-in-f14.1e100.net (216.58.210.206): icmp_seq=1 ttl=54 time=19.10 ms
64 bytes from lhr48s11-in-f14.1e100.net (216.58.210.206): icmp_seq=2 ttl=54 time=38.6 ms
64 bytes from lhr48s11-in-f14.1e100.net (216.58.210.206): icmp_seq=3 ttl=54 time=36.6 ms
64 bytes from lhr48s11-in-f14.1e100.net (216.58.210.206): icmp_seq=4 ttl=54 time=22.5 ms
64 bytes from lhr48s11-in-f14.1e100.net (216.58.210.206): icmp_seq=5 ttl=54 time=24.1 ms
64 bytes from lhr48s11-in-f14.1e100.net (216.58.210.206): icmp_seq=6 ttl=54 time=22.9 ms
^C
--- google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 12ms
rtt min/avg/max/mdev = 19.986/27.446/38.598/7.311 ms
3

You just needed to run apt-get update and retry your command to install your desired package.

The issue was that one of the dependencies (libpango in this case) which needed to be installed along with your desired package had been upgraded by your distro maintainer and that your (outdated) local list of packages made apt resolve the dependency with the old version. When it tried to download it, the servers returned a 404, indicating that the package of that version is no longer available.

1

OpenCV is supported by Raspbian from its repository. So what's a hassle to just install?

rpi ~$ sudo apt install python3-opencv

You will also find many additional packages with:

rpi ~$ apt list *opencv*

I would give it a try so you are on an up to date Raspbian version with the advantage to get always updated software from the repository.

  • ill give it a try – The Coding Clan Aug 17 '19 at 8:50
  • No. It failed, this is the hassle I was talking about. – The Coding Clan Aug 17 '19 at 9:03
  • @TheCodingClan But the error message you get is: "... 404 Not Found [IP: 93.93.128.193 80]". This has nothing to do with the installation of the packages. Your installation simply does not find the Raspbian server with its repository. You have to check your internet connection and/or the content of /etc/apt/sources.list and /etc/apt/sources.list.d/raspi.list. You must use the default Raspbian entries there. I have just installed sudo apt install python3-opencv on my RPi 4B without any problems (it took some time because of the big amount of additional packages). – Ingo Aug 17 '19 at 9:53
  • sources.list is deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi # Uncomment line below then 'apt-get update' to enable 'apt-get source' #deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi – The Coding Clan Aug 17 '19 at 9:58
  • the second one is : deb http://archive.raspberrypi.org/debian/ buster main # Uncomment line below then 'apt-get update' to enable 'apt-get source' #deb-src http://archive.raspberrypi.org/debian/ buster main – The Coding Clan Aug 17 '19 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.