Bug 1938581 - Insufficent 'Requires:`
Summary: Insufficent 'Requires:`
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: python-certbot-apache
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Felix Schwarz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1902420
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-14 17:54 UTC by Eugene A. Pivnev
Modified: 2021-03-15 10:29 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-03-15 10:25:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Eugene A. Pivnev 2021-03-14 17:54:45 UTC
1. Install minimal host with apache
2. def install certbot python3-certbot-apache
3. certbot --apache -d www.mydomain.com:

Traceback (most recent call last):
...
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 785, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1' distribution was not found and is required by requests
```

certbot-1.12.0-1.fc33.noarch
python3-certbot-apache-1.12.0-1.fc33.noarch

UPS: `dnf install python3-urllib3 python3-chardet` helps to this

Comment 1 Eugene A. Pivnev 2021-03-14 18:27:19 UTC
`dnf install python3-urllib3 python3-chardet` helps to this

Comment 2 Felix Schwarz 2021-03-14 20:14:58 UTC
I just checked this with a fresh Fedora 33 VM and I don't see any issues (it seems as everything works fine even though I did not actually retrieve a certificate - but network communication did work).

My best guess is that you system python install was messed up before. A common error is to use "pip install" as root (without virtualenv). This means you could have installed some incompatible libraries present in your python-path and certbot is one of the very few applications which checks that everything is fine.

"python3-urllib3" is required by python3-requests (<- python3-acme <- python3-certbot-apache) so it should have been installed before. Reinstalling "python3-urllib3" would remove pip-installed versions and restores the Fedora version (which works).

You could check if you still have left-overs in your Python path:

$ LANG=C rpm -qf /usr/lib/python3.9/site-packages/* | grep 'not owned by any package'
$ LANG=C rpm -qf /usr/lib64/python3.9/site-packages/* | grep 'not owned by any package'

If you see any output you (or some script) installed something there, bypassing rpm (this is bad and not supportable).

Please check again if you might have used "pip" in the past and accidentally damaged your system python.

Comment 3 Eugene A. Pivnev 2021-03-14 21:23:49 UTC
(In reply to Felix Schwarz from comment #2)
> I just checked this with a fresh Fedora 33 VM and I don't see any issues (it
> seems as everything works fine even though I did not actually retrieve a

As I commented above - use _minimal_ host.
Using rpmreaper after fresh installation (_any_ fresh installation).

Comment 4 Felix Schwarz 2021-03-14 21:33:40 UTC
> As I commented above - use _minimal_ host.

I did that. Still python3-urllib3 is a hard requirement for python3-requests so unless you force rpm to remove python3-urllib3 (or override it with pip) it must be present.

> Using rpmreaper after fresh installation (_any_ fresh installation).

That is a very important detail. I just installed it in my VM but I'm not sure how to use it. 

However "rpmreader" shows "python3-urllib3" and "python3-chardet" in yellow with an "L" in front of it. According to the man page that marks a leaf package which is not required by any other package. This is wrong (as you can verify yourself by trying to use "dnf remove python3-urllib3").

It seems upstream is https://github.com/mlichvar/rpmreaper and saw its last commit in May 2018. I guess that rpmreaper does not know about newer rpm dependencies types which are heavily used by Fedora. Unless there is some other repo with recent development it seems as if rpmreader should not be used on a modern Fedora system.

Comment 5 Felix Schwarz 2021-03-14 21:35:38 UTC
btw: the upstream repo has two open issues:

- Rpmreaper doesn't understand boolean dependencies #2
- ReqBy does not list parents of weak dependencies #4 

If rpmreaper does not understand these dependency types we should probably remove it from Fedora as using it will lead to a badly damaged system.

Comment 6 Felix Schwarz 2021-03-14 21:38:15 UTC
PS: I think dnf can help you removing unnecessary packages without any questionable tool like rpmreaper. Try "dnf repoquery --unneeded"

Comment 7 Eugene A. Pivnev 2021-03-14 22:06:12 UTC
(In reply to Felix Schwarz from comment #6)
> PS: I think dnf can help you removing unnecessary packages without any
> questionable tool like rpmreaper. Try "dnf repoquery --unneeded"

Rpmreaper is not he matter.
My host had no python3-urllib3 nor python3-chardet before and after installing python3-certbot-apache (that not requires certbot, by the way).
And worked ok with apache and some python3-based web applications.
Until certbot call.

Comment 8 Eugene A. Pivnev 2021-03-14 22:09:11 UTC
(In reply to Felix Schwarz from comment #5)
> btw: the upstream repo has two open issues:
> 
> - Rpmreaper doesn't understand boolean dependencies #2
> - ReqBy does not list parents of weak dependencies #4 
> 
> If rpmreaper does not understand these dependency types we should probably
> remove it from Fedora as using it will lead to a badly damaged system.

Rpmreaper _not_ removes packages.
It calls rpm for this.

Comment 9 Felix Schwarz 2021-03-14 22:18:47 UTC
> Rpmreaper is not he matter.
> My host had no python3-urllib3 nor python3-chardet before and after installing python3-certbot-apache (that not requires certbot, by the way).
> And worked ok with apache and some python3-based web applications.
> Until certbot call.

I'm not sure if I understand you correctly.

Previously you mentioned:

> Using rpmreaper after fresh installation (_any_ fresh installation).

As far as I understand rpmreaper is used to remove "unneeded" packages from a system.
- Did you use rpmreaper to remove any package before encountering this bug?
- If not why did you mention rpmreaper?

Besides I don't see any way you could end up with not having python3-urllib3 or python3-chardet if you do "dnf install certbot python3-certbot-apache". The RPM dependencies are present and correct.

> Rpmreaper _not_ removes packages.
> It calls rpm for this.

Actually "rpm" is a low-level tool. Calling "rpm" directly can be dangerous (and is in this case). For example I could remove "python3-urllib3" via rpmreaper/rpm without triggering any dependency warning. Only "dnf" knows about all dependencies. Try using "dnf remove python3-urllib3" and you will notice that dnf will remove "python3-certbot-apache".

So there is no bug in certbot (or Fedora's Python stack) but just a tool shipped in Fedora which seems to be quite dangerous.

Comment 10 Eugene A. Pivnev 2021-03-15 07:22:26 UTC
(In reply to Felix Schwarz from comment #9)
> Besides I don't see any way you could end up with not having python3-urllib3
> or python3-chardet if you do "dnf install certbot python3-certbot-apache".
> The RPM dependencies are present and correct.

Dnf _not_ installs them for me.
Try to use "install_weak_deps=False" in /etc/dnf/dnf.conf and recheck

Comment 11 Felix Schwarz 2021-03-15 09:46:21 UTC
This is my dnf.conf:

[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True
install_weak_deps=False

"dnf install certbot" now tries to install:
...
python3-chardet
python3-requests
python3-requests+security
python3-requests-toolbelt
python3-urllib3
...

So I still can not reproduce this. Can you check if you dnf.conf is somehow different?

Comment 12 Felix Schwarz 2021-03-15 09:49:00 UTC
Also my previous questions are still open:

- Did you use rpmreaper to remove any package before encountering this bug?
- If not why did you mention rpmreaper?

Comment 13 Eugene A. Pivnev 2021-03-15 10:18:13 UTC
(In reply to Felix Schwarz from comment #12)
> Also my previous questions are still open:
> 
> - Did you use rpmreaper to remove any package before encountering this bug?
> - If not why did you mention rpmreaper?

Today I installed new host (F33) from scratch.
After full cleanup (rpmreaper) I installed python3-certbot-apache.
Yes, it installed everything you wrote above.

Another question that python3-certbot has not certbot itself in Requires.
Is it normal?

Comment 14 Felix Schwarz 2021-03-15 10:25:34 UTC
> After full cleanup (rpmreaper) I installed python3-certbot-apache.

What do you mean by "full cleanup"? In my tests rpmreaper displayed some RPMs as "unused" even though they were required by other packages. As rpmreaper does not understand "rich dependencies" I think you should not use this on a recent Fedora system as you basically break your system by doing so.

> Yes, it installed everything you wrote above.

Good. I'll close this bug report then.

> Another question that python3-certbot has not certbot itself in Requires.
> Is it normal?

Yes. "certbot" is basically just the executable in "/usr/bin/certbot" while python3-certbot contains the all the actual code. Theoretically you could use only the "library" parts without installing /usr/bin/certbot. Just consider the presence of python3-certbot an implementation detail.

Comment 15 Felix Schwarz 2021-03-15 10:29:55 UTC
Btw: I think there is a RPM bug somewhere and rpm allows to uninstall python3-urllib3 even though python3-requests requires it. That is tracked as bug 1902420.


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