13

I have this issue when I search to install Gimp:

$ sudo apt-get install gimp 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gimp : Depends: libgimp2.0 (>= 2.10.18) but it is not going to be installed
        Depends: libgimp2.0 (<= 2.10.18-z) but it is not going to be installed
        Depends: libgegl-0.4-0 (>= 0.4.22) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Nothing change after apt update & upgrade. Do you have a solution for me? Thanks to

Best,

Numael
  • 143

3 Answers3

11

One solution is to use aptitude. It is generally smarter than apt-get at resolving dependencies.

First, install aptitude:

sudo apt-get install aptitude

Then install Gimp using aptitude:

sudo aptitude install gimp

And then after running that, Gimp should be installed.

Daniel M.
  • 1,903
  • Isn't aptitude already installed just apt? – ljrk May 29 '20 at 21:34
  • @larkey no, they're different things. – hobbs May 29 '20 at 23:07
  • Hm, can't remember where I picked that up. – ljrk May 30 '20 at 08:16
  • Quoted from the Debian wiki. Aptitude has a "score-based dependency resolver which is more suitable for interactive dependency resolution with additional hints from the user like "I don't want that part of the solution but keep that other part of the solution for your next try". Apt's dependency resolver on the other hand is optimized for good "one shot" solutions." – Daniel M. May 30 '20 at 08:20
  • 2
    Using aptitude I get: "The following packages have unmet dependencies: libgegl-0.4-0 : Depends: libopenexr23 which is a virtual package and is not provided by any available package

    The following actions will resolve these dependencies:

     Keep the following packages at their current version:
    
    1. gimp [Not Installed]                               
      
    2. libgegl-0.4-0 [Not Installed]                      
      
    3. libgimp2.0 [Not Installed]                         
      

    Accept this solution? [Y/n/q/?] " So it seems there is no solution with aptitude either.

    – Kvothe Dec 09 '20 at 15:37
  • 2
    Ok, nevermind you have to say "n" and it proposes another "solution" this time a real one since it installs the missing dependency. – Kvothe Dec 09 '20 at 15:40
  • Worked for me too. Thanks.:) – john400 Dec 09 '20 at 18:39
3

I would recommend installing Gimp as a flatpak, as the flatpak is maintained by the gimp developers.

sudo apt install flatpak

flatpak install flathub org.gimp.GIMP

and to run

flatpak run org.gimp.GIMP
Bruni
  • 10,542
  • Does not work on Linux Ubuntu 20.04.3 LTS – vitaliis Sep 13 '21 at 14:27
  • @vitaliis what does not work for you on ubuntu 20.04? it works for me on 20.04 and on 21.04. – Bruni Sep 13 '21 at 14:39
  • Maybe it's just my configaration: `Note that the directories

    '/var/lib/flatpak/exports/share' '/home/user/.local/share/flatpak/exports/share'

    are not in the search path set by the XDG_DATA_DIRS environment variable, so applications installed by Flatpak may not appear on your desktop until the session is restarted. error: app/org.gimp.GIMP/x86_64/master not installed`

    – vitaliis Sep 13 '21 at 14:40
  • @vitaliis this seems to be referenced in these bugs: https://bugs.launchpad.net/debian/+source/lxde-common/+bug/1905289 and upstream here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906288 . Though, you should be able to run the packages nonetheless, even on gnome. I am on Kubuntu at the moment on all my systems, so can not verify if it would work on gnome. – Bruni Sep 13 '21 at 14:48
  • Thanks, I'll try – vitaliis Sep 13 '21 at 14:51
2

Firstly, update and upgrade so everything is fresh:

sudo apt-get update && sudo apt-get upgrade -y

Then, try these two commands:

sudo dpkg --configure -a
sudo apt-get install -f

They will usually fix broken or unmet dependencies.

You can also look for JUST files related with your package and purge them, then reinstall them:

sudo dpkg --list
sudo apt-get purge <file-name>

Or you can use aptitude in place of apt or apt-get, aptitude is smarter than apt-get and will help deal with dependencies:

sudo aptitude install gimp

Hope it helps!

Ollie
  • 2,932
  • I would reorder the commands. As very first to a apt-get update (or apt or aptitude this does not matter here). This will make sure that the package list is recent and consistent and any problems that may have been resolved in the meantime are gone. There is a certain chance that this was a bug in the packaging and usually such bugs are detected and fixed quickly. – allo May 29 '20 at 21:02