1

My sudo apt install encountered problem when trying to install OpenCV. It fails on package libgfortran5, which OpenCV and libopencv-dev needs. The output is

The following packages have unmet dependencies:

libgfortran5 : Depends: gcc-11-base (= 11-20210417-1ubuntu1) but 11.1.0-1ubuntu1~21.04 is to be installed

E: Unable to correct problems, you have held broken packages.

I tried to downgrade gcc-11-base to 11-20210417-1ubuntu1 with command sudo apt-get install gcc-11-base=11-20210417-1ubuntu1, but it will remove 2.6G of stuff, which I believe will crash the system. So, I didn't say yes to "You are about to do something potentially harmful."

Please let me know if you have encountered this issue before. Thanks a lot!

Logistics:

  1. System: Ubuntu Desktop 21.04
  2. Hardware: Raspberry Pi 4B (8Gb men) aarch64
  3. Python: version 3.8.7 correctly installed (default)
  4. I might have messed around with /etc/apt/sources.list since I needed to add some random repository to install python3.8 (according to some tutorials) [I highly suspect that this is causing the problem.]

Thanks a lot,

Terry

.

To answer community suggestions:

Thank you guys for your prompt suggestions.

  1. I installed the Ubuntu 21.04 Desktop from this link https://ubuntu.com/download/raspberry-pi

  2. Yes, I understand that this is a arm system, which x86 packages will fail on any raspberry pi. I simply want to install opencv on pi, the command I ran to do so is "sudo apt install libopencv-dev python3-opencv" as suggested here https://linuxize.com/post/how-to-install-opencv-on-ubuntu-20-04/

  3. I tried that post, and it didn't solve the issue unfortunately (that's why I wrote this post). I don't have any hold packages. Aptitude did successfully install I think, but cv2 module cannot be found when I ran python

  4. In my /etc/apt/sources.list, I have the following links. I highly think these are mal-configured. Any idea of fixing it? Thanks a lot!

deb http://us.archive.ubuntu.com/ubuntu/ hirsute main
deb http://us.archive.ubuntu.com/ubuntu/ hirsute universe
deb http://ports.ubuntu.com/ubuntu-ports/ hirsute main universe multiverse

Also, when I installed python, I ran this command sudo add-apt-repository ppa:deadsnakes/ppa. Maybe this causes the issue?

Terry W
  • 11

0 Answers0