appveyor / ci

AppVeyor community support repository
https://www.appveyor.com
344 stars 66 forks source link

Ubuntu 20.04: apt-get install libopencv-dev fails #3434

Closed f4exb closed 4 years ago

f4exb commented 4 years ago

I am trying to install libopencv-dev in the Ubuntu 20.04 image but it fails:

[00:00:23] The following packages have unmet dependencies:
[00:00:23]  libopencv-dev : Depends: libopencv-calib3d-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-contrib-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-features2d-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-highgui-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-objdetect-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-shape-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-stitching-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-superres-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-video-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-videoio-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-videostab-dev (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv4.2-java (= 4.2.0+dfsg-5) but it is not going to be installed
[00:00:23]                  Depends: libopencv-calib3d4.2 (>= 4.2.0+dfsg) but it is not going to be installed
[00:00:23]                  Depends: libopencv-contrib4.2 (>= 4.2.0+dfsg) but it is not going to be installed
[00:00:23]                  Depends: libopencv-features2d4.2 (>= 4.2.0+dfsg) but it is not going to be installed
[00:00:23]                  Depends: libopencv-highgui4.2 (>= 4.2.0+dfsg) but it is not going to be installed
[00:00:23]                  Depends: libopencv-imgcodecs4.2 (>= 4.2.0+dfsg) but it is not going to be installed
[00:00:23]                  Depends: libopencv-videoio4.2 (>= 4.2.0+dfsg) but it is not going to be installed
[00:00:23]  libopencv-imgcodecs-dev : Depends: libopencv-imgcodecs4.2 (= 4.2.0+dfsg-5) but it is not going to be installed

This doesn't seem consistent. In an Ubuntu 20.04 VM using Virtualbox it works fine. libopencv-dev and its dependencues are correctly installed:

dpkg -l | grep -i opencv
ii  libopencv-calib3d-dev:amd64                   4.2.0+dfsg-5                        amd64        development files for libopencv-calib3d4.2                                                                                               
ii  libopencv-calib3d4.2:amd64                    4.2.0+dfsg-5                        amd64        computer vision Camera Calibration library                                                                                               
ii  libopencv-contrib-dev:amd64                   4.2.0+dfsg-5                        amd64        development files for libopencv-contrib4.2                                                                                               
ii  libopencv-contrib4.2:amd64                    4.2.0+dfsg-5                        amd64        computer vision contrlib library                                                                                                         
ii  libopencv-core-dev:amd64                      4.2.0+dfsg-5                        amd64        development files for libopencv-core4.2                                                                                                  
ii  libopencv-core4.2:amd64                       4.2.0+dfsg-5                        amd64        computer vision core library                                                                                                             
ii  libopencv-dev                                 4.2.0+dfsg-5                        amd64        development files for opencv                                                                                                             
ii  libopencv-dnn-dev:amd64                       4.2.0+dfsg-5                        amd64        development files for libopencv-dnn4.2                                                                                                   
ii  libopencv-dnn4.2:amd64                        4.2.0+dfsg-5                        amd64        computer vision Deep neural network module                                                                                               
ii  libopencv-features2d-dev:amd64                4.2.0+dfsg-5                        amd64        development files for libopencv-features2d4.2                                                                                            
ii  libopencv-features2d4.2:amd64                 4.2.0+dfsg-5                        amd64        computer vision Feature Detection and Descriptor Extraction library                                                                      
ii  libopencv-flann-dev:amd64                     4.2.0+dfsg-5                        amd64        development files for libopencv-flann4.2                                                                                                 
ii  libopencv-flann4.2:amd64                      4.2.0+dfsg-5                        amd64        computer vision Clustering and Search in Multi-Dimensional spaces library                                                                
ii  libopencv-highgui-dev:amd64                   4.2.0+dfsg-5                        amd64        development files for libopencv-highgui4.2                                                                                               
ii  libopencv-highgui4.2:amd64                    4.2.0+dfsg-5                        amd64        computer vision High-level GUI and Media I/O library                                                                                     
ii  libopencv-imgcodecs-dev:amd64                 4.2.0+dfsg-5                        amd64        development files for libopencv-imgcodecs4.2                                                                                             
ii  libopencv-imgcodecs4.2:amd64                  4.2.0+dfsg-5                        amd64        computer vision Image Codecs library                                                                                                     
ii  libopencv-imgproc-dev:amd64                   4.2.0+dfsg-5                        amd64        development files for libopencv-imgproc4.2                                                                                               
ii  libopencv-imgproc4.2:amd64                    4.2.0+dfsg-5                        amd64        computer vision Image Processing library                                                                                                 
ii  libopencv-ml-dev:amd64                        4.2.0+dfsg-5                        amd64        development files for libopencv-ml4.2                                                                                                    
ii  libopencv-ml4.2:amd64                         4.2.0+dfsg-5                        amd64        computer vision Machine Learning library                                                                                                 
ii  libopencv-objdetect-dev:amd64                 4.2.0+dfsg-5                        amd64        development files for libopencv-objdetect4.2                                                                                             
ii  libopencv-objdetect4.2:amd64                  4.2.0+dfsg-5                        amd64        computer vision Object Detection library                                                                                                 
ii  libopencv-photo-dev:amd64                     4.2.0+dfsg-5                        amd64        development files for libopencv-photo4.2                                                                                                 
ii  libopencv-photo4.2:amd64                      4.2.0+dfsg-5                        amd64        computer vision computational photography library                                                                                        
ii  libopencv-shape-dev:amd64                     4.2.0+dfsg-5                        amd64        development files for libopencv-shape4.2                                                                                                 
ii  libopencv-shape4.2:amd64                      4.2.0+dfsg-5                        amd64        computer vision shape descriptors and matchers library                                                                                   
ii  libopencv-stitching-dev:amd64                 4.2.0+dfsg-5                        amd64        development files for libopencv-stitching4.2                                                                                             
ii  libopencv-stitching4.2:amd64                  4.2.0+dfsg-5                        amd64        computer vision image stitching library                                                                                                  
ii  libopencv-superres-dev:amd64                  4.2.0+dfsg-5                        amd64        development files for libopencv-superres4.2                                                                                              
ii  libopencv-superres4.2:amd64                   4.2.0+dfsg-5                        amd64        computer vision Super Resolution library                                                                                                 
ii  libopencv-ts-dev:amd64                        4.2.0+dfsg-5                        amd64        development files for TS library of OpenCV (Open Computer Vision)                                                                        
ii  libopencv-video-dev:amd64                     4.2.0+dfsg-5                        amd64        development files for libopencv-video4.2                                                                                                 
ii  libopencv-video4.2:amd64                      4.2.0+dfsg-5                        amd64        computer vision Video analysis library                                                                                                   
ii  libopencv-videoio-dev:amd64                   4.2.0+dfsg-5                        amd64        development files for libopencv-videoio4.2                                                                                               
ii  libopencv-videoio4.2:amd64                    4.2.0+dfsg-5                        amd64        computer vision Video I/O library                                                                                                        
ii  libopencv-videostab-dev:amd64                 4.2.0+dfsg-5                        amd64        development files for libopencv-videostab4.2                                                                                             
ii  libopencv-videostab4.2:amd64                  4.2.0+dfsg-5                        amd64        computer vision video stabilization library                                                                                              
ii  libopencv-viz-dev:amd64                       4.2.0+dfsg-5                        amd64        development files for libopencv-viz4.2                                                                                                   
ii  libopencv-viz4.2:amd64                        4.2.0+dfsg-5                        amd64        computer vision 3D data visualization library                                                                                            
ii  libopencv4.2-java                             4.2.0+dfsg-5                        all          Java bindings for the computer vision library                                                                                            
ii  libopencv4.2-jni                              4.2.0+dfsg-5                        amd64        Java jni library for the computer vision library                                                                                         
ii  opencv-data                                   4.2.0+dfsg-5                        all          development data for opencv                                                                                                              

The appveyor.yaml can be found here: https://github.com/f4exb/sdrangel/blob/5c1de1510f702378e5eecf616a24cbca1a6cf32d/.appveyor.yml Complete link to failing job: https://ci.appveyor.com/project/f4exb/sdrangel/build/job/1djkuttwmcv4gnc4

Thanks and best regards.

f4exb commented 4 years ago

Verified, thanks!

jeff-j-chen commented 3 years ago

The fix for this is to run: sudo apt install libopencv-calib3d-dev libopencv-contrib-dev libopencv-features2d-dev libopencv-highgui-dev libopencv-imgcodecs-dev libopencv-objdetect-dev libopencv-shape-dev libopencv-stitching-dev libopencv-superres-dev libopencv-video-dev libopencv-videoio-dev libopencv-videostab-dev libopencv4.2-java libopencv-calib3d4.2 libopencv-contrib4.2 libopencv-features2d4.2 libopencv-highgui4.2 libopencv-imgcodecs4.2 libopencv-videoio4.2 libgdal26 libodbc1 I repeatedly added every package that Ubuntu said it would not install, and it looks like this is the full list of everything it needs. After running this installing libopencv-dev went without a hitch. A little interesting that Ubuntu knows which packages are needed but doesn't want to install them.

gzanellato-ia commented 3 years ago

Thanks 4a454646, it worked for me.

habibmuhammadthariq commented 2 years ago

The fix for this is to run: sudo apt install libopencv-calib3d-dev libopencv-contrib-dev libopencv-features2d-dev libopencv-highgui-dev libopencv-imgcodecs-dev libopencv-objdetect-dev libopencv-shape-dev libopencv-stitching-dev libopencv-superres-dev libopencv-video-dev libopencv-videoio-dev libopencv-videostab-dev libopencv4.2-java libopencv-calib3d4.2 libopencv-contrib4.2 libopencv-features2d4.2 libopencv-highgui4.2 libopencv-imgcodecs4.2 libopencv-videoio4.2 libgdal26 libodbc1 I repeatedly added every package that Ubuntu said it would not install, and it looks like this is the full list of everything it needs. After running this installing libopencv-dev went without a hitch. A little interesting that Ubuntu knows which packages are needed but doesn't want to install them.

I've try this command, but it comes up with another dependencies that is libavresample-dev. I tried to install it too, but again it's needs another dependencies. thus loop never end to me

jeff-j-chen commented 2 years ago

The fix for this is to run: sudo apt install libopencv-calib3d-dev libopencv-contrib-dev libopencv-features2d-dev libopencv-highgui-dev libopencv-imgcodecs-dev libopencv-objdetect-dev libopencv-shape-dev libopencv-stitching-dev libopencv-superres-dev libopencv-video-dev libopencv-videoio-dev libopencv-videostab-dev libopencv4.2-java libopencv-calib3d4.2 libopencv-contrib4.2 libopencv-features2d4.2 libopencv-highgui4.2 libopencv-imgcodecs4.2 libopencv-videoio4.2 libgdal26 libodbc1 I repeatedly added every package that Ubuntu said it would not install, and it looks like this is the full list of everything it needs. After running this installing libopencv-dev went without a hitch. A little interesting that Ubuntu knows which packages are needed but doesn't want to install them.

I've try this command, but it comes up with another dependencies that is libavresample-dev. I tried to install it too, but again it's needs another dependencies. thus loop never end to me

It looks like the loop will never end but just keep going, all the dependecies will be covered eventually

habibmuhammadthariq commented 2 years ago

Thanks for the comment @4a454646 , I've did it, and as i said before it never end. But i've actually managed those issue by replacing apt-get into aptitude. So it'd looks like "sudo aptitude install libopencv-dev"

bananahell commented 2 years ago

It looks like the loop will never end but just keep going, all the dependecies will be covered eventually

This did work for me and I could run my opencv projects in C++ as intended, but then I had another problem. After successfully doing this and running my codes, if I restarted my computer, my ubuntu wouldn't boot. I've tested this 4 times getting the same issue consistently, and then I formatted and reinstalled ubuntu 16, 18, and 20 and it happened all over again with all 3 OSs. Is anyone facing the same problem?

bananahell commented 2 years ago

I'd also like to point out that the same is happening when I try to install SDL2 libraries, with those dependencies errors, with it being "fixed" when I install all the required versions, and with my ubuntu boot being messed up in the end.

jeff-j-chen commented 2 years ago

That can happen unfortunately, it has happened to me on occasion (though not this one specifically). Installing packages as sudo can remove other necessary packages or create faults that, in worst case scenarios, brick the entire operating system.

Generally when I am installing packages, I save the output of apt list --installed beforehand, if it bricks my system I go to tty, do a diff betewen the two and revert changes back.

zhaochenyuangit commented 1 year ago

Thanks for the comment @4a454646 , I've did it, and as i said before it never end. But i've actually managed those issue by replacing apt-get into aptitude. So it'd looks like "sudo aptitude install libopencv-dev"

This works for me! I have installed a fresh Ubuntu20.04 but the problem persists with apt, with aptitude the packages are installed successfully.

MAVProxyUser commented 1 year ago

This helped me install libopencv-contrib-dev

Caroline-wen commented 8 months ago

vim /etc/apt/sources.list

add these commands to sources.list

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

update source

sudo apt-get update

reinstall

sudo apt install -y libopencv-dev