1

How should I fix the following problem?

(vision) mona@goku:~/research/code/vision/integration$ sudo apt-get install libopencv-dev python-opencv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libopencv-dev is already the newest version (4.2.0+dfsg-5).
python-opencv is already the newest version (2.4.9.1+dfsg-1.5ubuntu1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libopencv-highgui2.4v5 : Depends: libpng12-0 (>= 1.2.13-4) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
(vision) mona@goku:~/research/code/vision/integration$ sudo apt-get --fix-broken install libopencv-dev python-opencv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libopencv-dev is already the newest version (4.2.0+dfsg-5).
python-opencv is already the newest version (2.4.9.1+dfsg-1.5ubuntu1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libopencv-highgui2.4v5 : Depends: libpng12-0 (>= 1.2.13-4) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
(vision) mona@goku:~/research/code/vision/integration$ sudo apt-get --fix-broken install libpng12-0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  cpp-7 libpython-dev libpython2.7-dev libpython3-dev python2.7-dev python3-decorator python3-ipython-genutils
  python3-jupyter-core python3-traitlets python3.8-dev
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  libpng12-0
0 upgraded, 1 newly installed, 0 to remove and 92 not upgraded.
31 not fully installed or removed.
Need to get 0 B/116 kB of archives.
After this operation, 285 kB of additional disk space will be used.
(Reading database ... 408548 files and directories currently installed.)
Preparing to unpack .../libpng12-0_1.2.54-1ubuntu1_amd64.deb ...
Unpacking libpng12-0:amd64 (1.2.54-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1_amd64.deb (--unpack):
 unable to install new version of '/lib/x86_64-linux-gnu/libpng12.so.0': No such file or directory
No apport report written because the error message indicates an issue on the local system
                                                                                         Errors were encountered while processing:
 /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I am using the solution in https://stackoverflow.com/a/46460108/2414957 in order to solve the problem in https://stackoverflow.com/questions/65894955/cv2-destroyallwindows-is-not-implemented-when-installing-opencv-python-headles?noredirect=1#comment116527337_65894955

3
  • 1
    I am assuming that you are running this in Ubuntu 16.04? Try running sudo ldconfig first to fix the library files, then try running the sudo apt-get --fix-broken install
    – Terrance
    Jan 26, 2021 at 17:52
  • @Terrance I was told in IRC Ubuntu channel that the solution I tried was outdated. Hence I think we should close this since I was using Ubuntu 20.04. Thanks for checking.
    – Mona Jalal
    Jan 26, 2021 at 17:53
  • 2
    @N0rbert I have solved the problem askubuntu.com/a/1311150/165324
    – Mona Jalal
    Jan 26, 2021 at 19:35

0

Browse other questions tagged .