Bug 1737933

Summary: gimp depends on Python 2
Product: [Fedora] Fedora Reporter: Lumír Balhar <lbalhar>
Component: gimpAssignee: Nils Philippsen <nphilipp>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: anton4linux, bugzilla, debarshir, dominik, ferdnyc, jridky, klember, luya_tfz, mhroncok, mironov.ivan, mjg, nphilipp, pgnet.dev, phracek, prabesh432, pviktori, soerenmoeller2001, travneff, zdohnal
Target Milestone: ---Keywords: FutureFeature, Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-08 14:31:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1739543, 1739544, 1737988    
Bug Blocks: 1738968, 1751502, 2275263, 1698500    

Description Lumír Balhar 2019-08-06 11:42:20 UTC
Python 2.7 will reach end-of-life in January 2020, over 9 years after it was released. This falls within the Fedora 31 lifetime.
Packages that depend on Python 2 are being switched to Python 3 or removed from Fedora: https://fedoraproject.org/wiki/Changes/F31_Mass_Python_2_Package_Removal#Information_on_Remaining_Packages
Python 2 will be retired in Fedora 32: https://fedoraproject.org/wiki/Changes/RetirePython2

To help planning, we'd like to know the plans for gimp's future. Specifically:


- What is the reason for the Python2 dependency? (Is it software written in Python, or does it just provide Python bindings, or use Python in the build system or test runner?) 

- What are the upstream/community plans/timelines regarding Python 3?

- What is the guidance for porting to Python 3? (Assuming that there is someone who generally knows how to port to Python 3, but doesn't know anything about the particular package, what are the next steps to take?)


This bug is filed semi-automatically, and might not have all the context specific to gimp.
If you need anything from us, or something is unclear, please mention it here.

Thank you.

Comment 1 Ben Cotton 2019-08-13 17:08:08 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 2 Ben Cotton 2019-08-13 17:50:01 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.

Comment 3 Lumír Balhar 2019-08-14 08:50:43 UTC
Please answer the above questions. If you don't the package can be orphaned: https://fedoraproject.org/wiki/Changes/F31_Mass_Python_2_Package_Removal#Information_on_Remaining_Packages

If you need any information or help, please let us know.

Comment 4 Josef Ridky 2019-08-14 09:08:05 UTC
Unfortunately, GIMP upstream don't plan to switch from Python2 to Pyton3 in GIMP-2.10 release cycle and GIMP without Python2 support looses a lot from it's functionality.

What are our options for f31?

We have gimp-module available, so would it be possible to use Python 2 as module in f31+ releases?

What we should do with rpms/gimp fXX branches?

Comment 5 Petr Viktorin (pviktori) 2019-08-14 11:00:22 UTC
Hi,
Fedora 31 (and lower) should stay as it is.

For Fedora 32, AFAICS best option is to file a FESCo exception for GIMP and its dependencies.

We track the dependencies here: https://fedora.portingdb.xyz/grp/gimp/
Currently gimp pulls in 49 packages as transitive dependencies. Many of those could probably be trimmed. Could you take a look at the list and check which ones are essential for Gimp to run?

Comment 6 Lumír Balhar 2019-08-15 06:35:54 UTC
Petr provided the info.

Comment 7 Josef Ridky 2019-08-19 12:30:31 UTC
From GIMP perspective, the most important are python2-devel, pygobject2, gtk2 and pygtk2.

From GIMP upstream, they would like to have the python2 available for GIMP-2.10 as long as possible. They are already working on GIMP 3 with python3 support, but they haven't set any release date for this version yet.

Comment 8 Petr Viktorin (pviktori) 2019-08-19 12:50:19 UTC
The content of python2-devel will be available (in a different package, python27, but we can help with the transition).

You should check with pygobject2, gtk2, pygtk2 maintainers what the plans are. I've asked them for info here:
pygobject2: https://bugzilla.redhat.com/show_bug.cgi?id=1739544
gtk2: https://bugzilla.redhat.com/show_bug.cgi?id=1737988
pygtk2: https://bugzilla.redhat.com/show_bug.cgi?id=1739543

Some seem to be non-responsive. If you can reach them outside Bugzilla, it would be helpful.

What about pycairo, libglade2, python2-numpy? Does gimp need them, or are they (from your point of view) just implementation details of other packages?

If maintainers of the dependencies are willing to keep the Python 2 parts in Fedora, the next step is filing an FESCo exception. Here's an example: https://pagure.io/fesco/issue/2208

Comment 9 Petr Viktorin (pviktori) 2019-08-19 14:57:32 UTC
It would make sense to include the plugin gimp-layer-via-copy-cut in the FESCo exception, as well.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1738968

Comment 10 Miro Hrončok 2019-09-16 21:53:43 UTC
I've tried to rebuild gimp without pycairo-devel and pygobject2-devel BRs. https://koji.fedoraproject.org/koji/taskinfo?taskID=37693721

It works, however pygtk2-devel brings both of them in.

Comment 11 Miro Hrončok 2019-09-19 12:19:36 UTC
I've noticed that gimp is modularized. Can we just build all the Python 2 dependencies in that module and retire the stack in rawhide?

Comment 12 Miro Hrončok 2019-09-23 22:38:30 UTC
I see two ways to go forward:


Way 1 - FESCo exception for:

 - gimp
 - gimp-layer-via-copy-cut
 - pygobject2
 - pygtk2
 - python2-numpy
 - pycairo (we don't know yet if the maintainers agree to keep the Python 2 subpackages)


Way 2 - put the abovementioned packages to the GIMP module and retire nonmodular GIMP.



It would really made me much more comfortable if we get this sorted out sooner than later. I don't want to retire GIMP in November.

Comment 13 Josef Ridky 2019-09-24 06:34:35 UTC
Hi Miro,

due we shipping GIMP as module already [1] I am fine with the way #2.

Can you help me with necessary steps to make this change as smooth as possible?

[1] https://src.fedoraproject.org/modules/gimp/tree/2.10

Comment 14 Kalev Lember 2019-09-24 06:37:29 UTC
In addition to rpm GIMP, I care about GIMP flatpak that we are already building and shipping in Fedora. The flatpak builds use MBS, so this can use the same solution as #2.

There may be issues building Python 2 with --prefix=/app for flatpak, but if this is the consensus to go forward I'd be happy to submit patches to python2 to help fix that.

Comment 15 Miro Hrončok 2019-09-24 08:51:27 UTC
> Can you help me with necessary steps to make this change as smooth as possible?

I'm not sure, how can I help?

Comment 16 Miro Hrončok 2019-09-24 09:29:48 UTC
I forgot to mention: The Python Maintanence team can help here with way 1 (requesting the exception). We cannot really help with modularizing stuff.

Comment 17 Josef Ridky 2019-09-24 09:33:53 UTC
Due we already have gimp module, I need just someone (form modularity team?) to check, if all dependencies (esp. to python2 module) will be set correctly.

Do you know anyone, who can help me with it?

Comment 18 Miro Hrončok 2019-09-24 09:42:13 UTC
There is no python2 module. I don't know anyone who can help you.

Comment 19 Petr Viktorin (pviktori) 2019-09-24 10:23:45 UTC
> Can you help me with necessary steps to make [modular Gimp] as smooth as possible?

I can think of tho things that will not be smooth:

1. It's possible that we won't remove all dependencies at once. If we, for example, drop python2-numpy in F31, pycairo in F32, and pygtk2 in F33, these will need to be added to the Gimp module. As far as I know, there is no mechanism to check if they will conflict with any other modules, or (if there's a single Gimp stream for all Fedoras), with non-modular RPMs in older Fedora releases. And if they do conflict, I don't know what will happen and how things will be coordinated.

2. As a user, when I install Gimp, I get the "2.10" module. As far as I can see, it won't upgrade when 3.0 comes out: if I want that, I'll need to watch for Gimp release and switch streams manually (maybe even uninstall, switch streams, and reinstall). If i stay on 2.10, I don't know what will happen when 2.10 stops being supported.

Unfortunately, as far as I know, Modularity has no good answers to these (future) issues. I don't know what to do to solve them.
I'd be willing to treat these as the cost to pay for things being better in the future. But unfortunately, I don't really see any problem that Modularity solves *for Gimp in Fedora*. I am not aware of any benefit we'd get for enduring the annoyances.


I can help with a FESCo exception (that's mostly a way to ensure everything is coordinated, relevant people are notified and the packages are listed), and I can offer some help with maintaining the dependencies for Gimp until it is ported. But I *don't know* how to do things properly in a module.

Comment 20 Kalev Lember 2019-09-25 06:54:28 UTC
(In reply to Kalev Lember from comment #14)
> In addition to rpm GIMP, I care about GIMP flatpak that we are already
> building and shipping in Fedora. The flatpak builds use MBS, so this can use
> the same solution as #2.
> 
> There may be issues building Python 2 with --prefix=/app for flatpak, but if
> this is the consensus to go forward I'd be happy to submit patches to
> python2 to help fix that.

I've filed https://src.fedoraproject.org/rpms/python2/pull-request/49 to fix an issue with python2 flatpak builds.

Comment 21 Josef Ridky 2019-09-25 13:59:39 UTC
To be honest, now I really don't know, which way I should go.

But due of possible issues in modularity, which aren't solved yet, I would request FESCo exception for GIMP.
It looks like safer way now.

What do you think? Do we have some template for exception request?

Comment 22 Miro Hrončok 2019-09-25 14:21:59 UTC
Before we proceed, Kalev, you are the main admin of pycairo. Would you be OK to keep Python 2 bits of pycairo around until GIMP is ported to Python 3?

Comment 23 Kalev Lember 2019-09-25 14:23:23 UTC
Yes, I would be OK with that.

Comment 24 Miro Hrončok 2019-09-25 14:32:07 UTC
I'm now checking whether we can remove numpy (and setuptools) from the equation: https://src.fedoraproject.org/rpms/pygtk2/pull-request/1

Comment 25 Miro Hrončok 2019-09-25 14:53:23 UTC
(In reply to Miro Hrončok from comment #24)
> I'm now checking whether we can remove numpy (and setuptools) from the
> equation: https://src.fedoraproject.org/rpms/pygtk2/pull-request/1

This is blocked by ~recent pango update.


I propose the following:

We assume numpy si not needed. We only include gimp, gimp-layer-via-copy-cut, pygobject2, pygtk2, and pycairo in the exception request. If we later realize we indeed need to keep numpy, we request additional one for it.


Here is the draft:

"""
Hello, we'd like to request a Python 2 exception for GIMP (gimp + gimp-layer-via-copy-cut packages).

It needs the following Python 2 packages to run and build (apart from the interpreter itself):

 - pygobject2
 - pygtk2
 - pycairo

The maintainers of the 3 packages are ready to keep maintaining the Python 2 parts of their packages as long as GIMP needs them.

We consider GIMP important for Fedora users.

The gimp-layer-via-copy-cut package only uses Python 2 because of GIMP and has no further Python 2 dependencies. There are other `gimp-*` packages out there, but none of them depends on Python directly (only trough GIMP), to clarify, we want to keep them as well.

See the discussion in https://bugzilla.redhat.com/show_bug.cgi?id=1737933
"""

WDYT?

Comment 26 Petr Viktorin (pviktori) 2019-09-26 07:04:26 UTC
There is also gimp-resynthesizer. I think it would be good to include it in the exception.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1751502

Comment 27 Josef Ridky 2019-09-26 07:14:15 UTC
Request posted https://pagure.io/fesco/issue/2238

Thanks for help.

Comment 28 Miro Hrončok 2019-09-26 07:25:12 UTC
Oh, I haven't figured out that gimp-resynthesizer is still a thing, It fails to build for more than a year. Sorry about that. I see it is part of the exception request.

Comment 29 Luya Tshimbalanga 2019-09-28 18:27:08 UTC
(In reply to Miro Hrončok from comment #28)
> Oh, I haven't figured out that gimp-resynthesizer is still a thing, It fails
> to build for more than a year. Sorry about that. I see it is part of the
> exception request.

I recently took over gimp-resynthesizer maintenance and updated to the latest upstream release: 
https://bodhi.fedoraproject.org/updates/FEDORA-2019-205f6d17d6

Blocker added to keep track of this report.

Comment 30 Luya Tshimbalanga 2019-09-28 18:34:42 UTC
(In reply to Kalev Lember from comment #14)
> In addition to rpm GIMP, I care about GIMP flatpak that we are already
> building and shipping in Fedora. The flatpak builds use MBS, so this can use
> the same solution as #2.
> 
> There may be issues building Python 2 with --prefix=/app for flatpak, but if
> this is the consensus to go forward I'd be happy to submit patches to
> python2 to help fix that.

Speaking about gimp, is there a documentation guideline to effectively prepare a flatpak version of addons? I am aware flatpak getdit did before.
Wearing my design suite lab maintainer hat, I am aiming to use Fedora Silverblue as a base system.

Comment 31 Kalev Lember 2019-09-29 14:24:38 UTC
(In reply to Luya Tshimbalanga from comment #30)
> Speaking about gimp, is there a documentation guideline to effectively
> prepare a flatpak version of addons?

As far as I now, fedora flatpak infra does not support app extensions yet. A way to work this around would be to just package the plugins in the same flatpak together with the main app. Is there something specific you need?

Comment 32 Luya Tshimbalanga 2019-10-03 17:00:38 UTC
(In reply to Kalev Lember from comment #31)
> (In reply to Luya Tshimbalanga from comment #30)
> > Speaking about gimp, is there a documentation guideline to effectively
> > prepare a flatpak version of addons?
> 
> As far as I now, fedora flatpak infra does not support app extensions yet. A
> way to work this around would be to just package the plugins in the same
> flatpak together with the main app. Is there something specific you need?

Just a guideline for that workaround. Otherwise I will wait for the Fedora Flatpak infra to enable support of app extensions.

Comment 33 Ben Cotton 2020-02-11 15:48:15 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 34 Debarshi Ray 2020-06-08 14:31:41 UTC
FESCo granted an exception to let GIMP continue using Python 2:
https://pagure.io/fesco/issue/2238

Closing as CURRENTRELEASE.

Comment 35 Miro Hrončok 2020-06-08 14:35:22 UTC
It granted the exception, but we still want to get this eventually solved.

Comment 36 Pranav 2021-05-30 06:08:22 UTC
I used GIMP in Ubuntu 21.04 where there was no Python 2 if I remember it correctly.

But here in Fedora 34, trying to uninstall Python 2 means trying to uninstall GIMP.

How come?

Comment 37 Michael J Gruber 2021-05-30 09:07:04 UTC
(In reply to Pranav Bhattarai from comment #36)
> I used GIMP in Ubuntu 21.04 where there was no Python 2 if I remember it
> correctly.
> 
> But here in Fedora 34, trying to uninstall Python 2 means trying to
> uninstall GIMP.
> 
> How come?

On a fresh (up-to-date) F34 I have:

gimp-2:2.10.24-1.fc34 (plus libs and helps)
python2.7-2.7.18-11.fc34
python2-cairo-1.18.2-8.fc34

The latter two are pulled in by gimp because gimp 2.10 still requires python 2 for its python plugins.

If Ubuntu has a gimp package without python 2 then it has a gimp without python plugins (unless they package gimp 2.99, aka the unstable development version, which I don't think).

It's a mixed bag, of course: Basically, the Fedora approach works only for python plugins which do not require additional (py2) modules such as numpy (still in F33, not in F34), scipy etc. That's why there have been alternative attempts via modules (cancelled) and flatpaks which provide a more complete py2 stack without "tainting" the base system. Maybe Ubuntu does something similar with snap.

Comment 38 Pranav 2021-05-30 15:15:32 UTC
Thanks for the info. Learned a new thing.

Comment 39 Andrew 2022-05-18 18:42:11 UTC
Still actual for Fedora 36.
I don't need python2 and don't need GIMP plugins maybe, but can't erase python2 rpm because GIMP package depends on it.

Comment 40 "FeRD" (Frank Dana) 2022-05-21 16:38:34 UTC
(In reply to Pranav from comment #36)
> I used GIMP in Ubuntu 21.04 where there was no Python 2 if I remember it
> correctly.

I looked into this. Surprisingly enough, it's true: Ubuntu 22.04's apt-installable GIMP is devoid of any Python support whatsoever. No Python2, no Python3.

It definitely feels a bit stripped-down, as a result, since entire menus of features are missing due to their being implemented in Python. (The entire Layer Effects menu, for example, is conspicuously absent.) But it is, apparently, possible, albeit with some big caveats.


(In reply to Andrew from comment #39)
> Still actual for Fedora 36.
> I don't need python2 and don't need GIMP plugins maybe, 

Well, you DO need Python2 if you have GIMP installed, because a complete install of GIMP 2.10 (like the one Fedora's packages provide) includes the /usr/lib64/gimp/2.0/interpreters/pygimp.interp file that defines Python 2 as one of its scripting interpreters.

It's not just for external plugins — several of GIMP's bundled features are implemented in Python, and while it's *possible* to strip them out (as Ubuntu have demonstrated), doing so means that you don't get the complete feature set.

Hopefully GIMP 3.0 will be along sooner rather than later.... and hopefully it gets packaged for Fedora, and doesn't end up perpetually deferred. (Like the ImageMagick 7 upgrade that's apparently NEVER coming. The first IM7 release was in NOVEMBER 2015!)

Comment 41 "FeRD" (Frank Dana) 2023-10-14 11:01:31 UTC
And over a year later, GIMP 3.0 remains vaporware. But we finally have ImageMagick 7, at least.

(Also, I just noticed that one of the roadmap items[1] for GIMP 3.0 is to "complete the GTK+3 port". Just in time!)

[1]: https://developer.gimp.org/core/roadmap/

Comment 42 Petr Viktorin (pviktori) 2023-10-17 08:04:08 UTC
The list of blockers is shrinking, though. Just very slowly: https://gitlab.gnome.org/GNOME/gimp/-/issues?scope=all&state=opened&milestone_title=3.0&label_name[]=Blocker

Comment 43 Adri Verhoef 2024-04-14 11:38:09 UTC
Two days ago, I installed Fedora 40 from the XFCE-Spin (# dnf system-upgrade download --releasever=40) and yesterday I installed gimp-2.10.36-2.fc40.x86_64.
After starting GIMP, 12 errors like below emerged:

$ gimp
Traceback (most recent call last):
  File "/usr/lib64/gimp/2.0/plug-ins/spyro_plus/spyro_plus.py", line 18, in <module>
    from gimpshelf import shelf
  File "/usr/lib64/gimp/2.0/python/gimpshelf.py", line 40, in <module>
    import gimp
ImportError: could not import pygtk
gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error

I quit Gimp and decided to install pygtk2 (# dnf install pygtk2.x86_64):
Downloading Packages:
(1/3): python2-cairo-1.18.2-16.fc40.x86_64.rpm
(2/3): pygobject2-2.28.7-21.fc40.x86_64.rpm
(3/3): pygtk2-2.24.0-43.fc40.x86_64.rpm
... and restarted Gimp.  All 12 error messages were gone!

I quit Gimp again.
Next, to reproduce the problem, I de-installed pygtk2 (# dnf erase pygtk2) and removed the directory ~/.config/GIMP/.
Then I restarted Gimp and the 12 errors re-appeared.

Comment 44 Miro Hrončok 2024-04-16 10:26:58 UTC
If you have problems with GIMP, please open separate bug report(s).