Bug 1329629 - Missing dependencies: "ImportError: No module named yum"
Summary: Missing dependencies: "ImportError: No module named yum"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: fedora-easy-karma
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Till Maas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1425272 (view as bug list)
Depends On: 1304355
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-22 12:15 UTC by Christian Stadelmann
Modified: 2017-02-23 01:05 UTC (History)
5 users (show)

Fixed In Version: fedora-easy-karma-0-0.28.20150921gitc932687a.fc23
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-21 20:23:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Provide a helpful message to install python2-dnf (997 bytes, patch)
2017-02-23 01:05 UTC, Guy Taylor
no flags Details | Diff

Description Christian Stadelmann 2016-04-22 12:15:21 UTC
Description of problem:
fedora-easy-karma fails to start by default.

Version-Release number of selected component (if applicable):
fedora-easy-karma-0-0.28.20150921gitc932687a.fc24.noarch
Same on Fedora 23 Build 10 iso and Fedora 24 Alpha Build 7 iso.

How reproducible:
always – packaging issue

Steps to Reproduce:
1. install fedora-easy-karma
2. try to run it

Actual results:
It fails to run. Traceback:

$ fedora-easy-karma 
Traceback (most recent call last):
  File "/usr/bin/fedora-easy-karma", line 47, in <module>
    import yum
ImportError: No module named yum

Expected results:
Run. This might require some dependencies. Doesn't RPM provide OR dependencies?

If you don't want to pull in these dependencies, please add some code handling missing these and suggesting how to fix it. This is not perfect in terms of user experience, but it is doable and better than always crashing.

Additional info:
This is related to bug #1270600 and a duplicate imho, but in https://bugzilla.redhat.com/show_bug.cgi?id=1270600#c21 it was suggested that I open a new issue. It might be a good suggestion to keep this discussion on a technical level though.

Comment 1 Christian Stadelmann 2016-04-22 12:24:39 UTC
An alternative solution would be to port f-e-k to run on both python2 and python3 and run with python3 by default on Fedora 23+, where python3-dnf is installed but python2-dnf is not. Fedora 23+, dnf is the default and thus f-e-k should depend on python3-dnf.

Comment 2 Till Maas 2016-04-23 06:59:46 UTC
1) I cannot use rich dependencies (OR dependencies), because the tools used to compose Fedora do not support them right now, but this would be the ideal solution I guess
2) Porting to python3 is not possible as long as python-fedora is not available for python3

How did you install f-e-k? AFAIK in the default setting, dnf should install python2-dnf with the recent update, because it is recommended now.

Comment 3 Christian Stadelmann 2016-04-23 09:55:58 UTC
(In reply to Till Maas from comment #2)
> 1) I cannot use rich dependencies (OR dependencies), because the tools used
> to compose Fedora do not support them right now, but this would be the ideal
> solution I guess

Yeah, that's bad circumstances.

> 2) Porting to python3 is not possible as long as python-fedora is not
> available for python3

Actually, it is: The package is called `python3-fedora`.

`fedora-cert` isn't ported to python3 BUT it's just 74 lines of text (~50 lines of code). And it depends on pyOpenSSL, which is available for python3 (python3-pyOpenSSL) and python-pycurl, which is available for python3 (python3-pycurl). It looks doable as long as one is able to reach the packager of `fedora-cert`.


(In reply to Till Maas from comment #2)
> 
> How did you install f-e-k? AFAIK in the default setting, dnf should install
> python2-dnf with the recent update, because it is recommended now.

I just ran `dnf install fedora-easy-karma` and got a broken installation. As written above I also tested live isos, which also resulted in broken systems.

I don't see how python2-dnf should be pulled in. The spec file [1] just

Recommends:     python2-dnf

. As the packaging guidelines [2] specify, weak dependencies are ignored by default by dnf. This is why f-e-k doesn't pull in python2-dnf.

[1] https://pkgs.fedoraproject.org/cgit/rpms/fedora-easy-karma.git/tree/fedora-easy-karma.spec?h=f24
[2] https://fedoraproject.org/wiki/Packaging:WeakDependencies

Comment 4 Till Maas 2016-04-23 10:31:18 UTC
(In reply to Christian Stadelmann from comment #3)
> (In reply to Till Maas from comment #2)

> > 2) Porting to python3 is not possible as long as python-fedora is not
> > available for python3
> 
> Actually, it is: The package is called `python3-fedora`.
> 
> `fedora-cert` isn't ported to python3 BUT it's just 74 lines of text (~50
> lines of code). And it depends on pyOpenSSL, which is available for python3
> (python3-pyOpenSSL) and python-pycurl, which is available for python3
> (python3-pycurl). It looks doable as long as one is able to reach the
> packager of `fedora-cert`.

Thank your for researching this. Would you able to create a patch to make fedora-cert python3 ready?

> (In reply to Till Maas from comment #2)
> > 
> > How did you install f-e-k? AFAIK in the default setting, dnf should install
> > python2-dnf with the recent update, because it is recommended now.
> 
> I just ran `dnf install fedora-easy-karma` and got a broken installation. As
> written above I also tested live isos, which also resulted in broken systems.
> 
> I don't see how python2-dnf should be pulled in. The spec file [1] just
> 
> Recommends:     python2-dnf
> 
> . As the packaging guidelines [2] specify, weak dependencies are ignored by
> default by dnf. This is why f-e-k doesn't pull in python2-dnf.

I understand the guidelines differently:

| Weak dependencies are by default treated similarly to regular Requires:. 
| Matching packages are added to the dnf transaction. If adding the package
| would lead to an error dnf will by default ignore the dependency.

For me this sounds like python2-dnf should be installed by default. If it was a "Hint:" dependency, then it would be ignored. Is there maybe a bug in dnf?

Comment 5 Christian Stadelmann 2016-04-23 11:25:16 UTC
(In reply to Till Maas from comment #4)
> Thank your for researching this. Would you able to create a patch to
> make fedora-cert python3 ready?

I'll try.

> (In reply to Christian Stadelmann from comment #3)
> > As the packaging guidelines [2] specify, weak dependencies are ignored by
> > default by dnf. This is why f-e-k doesn't pull in python2-dnf.
> 
> I understand the guidelines differently:
> 
> | Weak dependencies are by default treated similarly to regular Requires:. 
> | Matching packages are added to the dnf transaction. If adding the package
> | would lead to an error dnf will by default ignore the dependency.
> 
> For me this sounds like python2-dnf should be installed by default. If it
> was a "Hint:" dependency, then it would be ignored. Is there maybe a bug in
> dnf?

Same document:

| Weak dependencies may only be used in a package if the package still functions without the dependency present.

So the packaging of f-e-k is wrong. But that hopefully won't matter with the python3-dnf stuff.

Yes, looks like a bug in dnf. I've reported it as bug #1329805.

Comment 6 pavel raur 2016-05-17 07:47:44 UTC
Bug is still unsolved.

I'm using the same version of fedora-easy-karma.
fedora-easy-karma-0-0.28.20150921gitc932687a.fc24.noarch

bug:
File "/usr/bin/fedora-easy-karma", line 47, in <module>
    import yum
ImportError: No module named yum

Comment 7 Christian Stadelmann 2016-07-19 20:00:26 UTC
(In reply to Christian Stadelmann from comment #5)
> (In reply to Till Maas from comment #4)
> > Thank your for researching this. Would you able to create a patch to
> > make fedora-cert python3 ready?
> 
> I'll try.

Sorry, I can't. I don't know enough about python to fix this.

Yes, issue is still present on Fedora 24.

Comment 8 Till Maas 2016-08-07 14:49:00 UTC
*** Bug 1270600 has been marked as a duplicate of this bug. ***

Comment 9 Raphael Groner 2016-08-07 15:32:41 UTC
Again: It works for me with 'dnf install python2-dnf'.

Comment 10 Emerson Santos 2016-08-10 02:02:50 UTC
(In reply to Raphael Groner from comment #9)
> Again: It works for me with 'dnf install python2-dnf'.

For me too

Comment 11 Christian Stadelmann 2016-09-19 14:01:58 UTC
(In reply to Emerson Santos from comment #10)
> (In reply to Raphael Groner from comment #9)
> > Again: It works for me with 'dnf install python2-dnf'.

That's not a fix. If f-e-k doesn't pull in the dependency itself it has a broken .spec file.

Since weak dependencies have landed in F24 repositories now it works fine for me and f-e-k is pulling in python2-dnf correctly. Technically, this solution is still not correct because python2-dnf is just recommended, but not required. But that should be no problem to most users. If you don't care about correctness but just about "it works", feel free to close this bug.

Comment 12 Fedora Update System 2016-09-19 20:09:09 UTC
fedora-easy-karma-0-0.28.20150921gitc932687a.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a1ad1a4378

Comment 13 Fedora Update System 2016-09-21 20:23:24 UTC
fedora-easy-karma-0-0.28.20150921gitc932687a.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Guy Taylor 2017-02-23 00:37:59 UTC
*** Bug 1425272 has been marked as a duplicate of this bug. ***

Comment 15 Guy Taylor 2017-02-23 01:05:07 UTC
Created attachment 1256753 [details]
Provide a helpful message to install python2-dnf

On Fedora 25 I ran into this issue. Installing the "fedora-easy-karma" package via DNF lead to a broken install until a manual install of python2-dnf.

I would suggest something along the lines of this patch to help aid users.


Note You need to log in before you can comment on or make changes to this bug.