In the use of Ubuntu, you will often encounter this sentence:“E: Error cannot be fixed because you require certain software packages to remain as they are and that they break dependencies between software packages.”

There are plenty of online solutions to this problem, but most are unreliable. Previously I normally handled it manually (of course we could also use aptitude to automatically solve the install dependency problem, see details below) and if it was a software version problem, install the specified version directly. Such as:

In the display liblapack3: dependencies: libgfortran3 (>= 4.6) but it will not be installed E: cannot fix the error because you require certain packages to remain as they are, which is that they break dependencies between software packages. Sudo apt-get -f install libgfortran3>=4.6 sudo apt-get -f install libgfortran3>=4.6

But as you can see in the picture, not this time. Why? Generally speaking, the problem with installing the software version is that the software version is too high. But that’s not the case here, because there are a lot of other dependencies on installing this software that aren’t available here.

This is where the next approach comes in.

Aptitude instead of APT. Aptitude, like apt-get, is an extremely powerful package management tool in Debian and its derivatives. Aptitude unlike apt-get is better at handling dependencies. For example, when aptitude deletes a package, it also deletes its dependent package. This way, there are no useless packages left in the system, and the whole system is cleaner. When installing software, it can not only provide common functions like APT, but also provide solutions when installing dependency conflicts.

Sudo aptitude install R-base-core sudo aptitude install R-base-core sudo aptitude install R-base-core Initially aptitude will also detect dependency conflicts like APT and give a solution. But the difference is that you have three options for the solution (Y/N/Q), where y is yes, N is no, and you move on to the next solution. Q – > Exit to abort the installation. If it is recommended not to install at first, you can choose N, and generally the second solution will automatically downgrade the installation dependent software (if it is a series of software versions too high), in which case the option to agree will probably be successful.

As shown in figure:

The only fly in the ointment, however, is that the software version will be lower after installation. But it does work.

reference

  1. Install R in Ubuntu
  2. Ubuntu addresses package dependencies