SLES 12 SP5 mismatch in python modules python3-requests vs. python3-urllib3

These details were described here; but I'll try to recap:
https://bugzilla.suse.com/show_bug.cgi?id=1187070
I'm trying to run a python3 program that cannot find a python module that is installed via an RPM:

10-153-30-11:~ # /usr/bin/cloud-init init |& tail -1
pkg_resources.DistributionNotFound: The 'requests' distribution was not found and is required by cloud-init

The set of packages are a consequence of SLES's own dependencies, and are from their own repositories; cloud-init uses 3.4, which requires 'python3-requests', which in turn requires python 3.6:

10-153-30-11:~ # head -1 /usr/bin/cloud-init

!/usr/bin/python3

10-153-30-11:~ # ls -ld /usr/bin/python3
lrwxrwxrwx 1 root root 9 May 11 16:30 /usr/bin/python3 -> python3.4

10-153-30-11:~ # rpm -qf /usr/bin/cloud-init
cloud-init-20.2-37.50.8.x86_64
10-153-30-11:~ # rpm -q --requires cloud-init | grep requests
python3-requests

10-153-30-11:~ # rpm -ql python3-requests | egrep 'requests$'
/usr/lib/python3.6/site-packages/requests
/usr/share/doc/packages/python3-requests
/usr/share/licenses/python3-requests

10-153-30-11:~ # rpm -q --requires python3-requests | head -2
ca-certificates
python(abi) = 3.6

10-153-30-11:~ # rpm -q python3-requests
python3-requests-2.25.1-4.1.noarch

It turns out that this SLES 12 SP5 box has two versions of python 3 installed:

10-153-30-11:~ # rpm -qa | egrep -e 'python3.*-base'
python36-base-3.6.13-4.36.1.x86_64
python3-base-3.4.10-25.66.1.x86_64

I can repro the cloud-init directly:

10-153-30-11:~ # python3.4 -c 'import requests;'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'requests'

Looks like python3-requests really needs python3.6:

10-153-30-11:~ # rpm -ql python3-requests-2.25.1-4.1.noarch | egrep 'requests$'
/usr/lib/python3.6/site-packages/requests
/usr/share/doc/packages/python3-requests
/usr/share/licenses/python3-requests

If I try my repro with 3.6, I get a different error:

Slightly different error:

10-153-30-11:~ # python3.6 -c 'import requests;'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
ModuleNotFoundError: No module named 'urllib3'

But, that's installed for 3.4:

10-153-30-11:~ # rpm -ql python3-urllib3-1.22-3.23.1.noarch | grep 'urllib3$'
/usr/lib/python3.4/site-packages/urllib3
/usr/share/doc/packages/python3-urllib3

So, neither python 3.4 or 3.6 can use the 'requests' module, as SLES's supplied RPMs for 'python3' are really built for different versions of python 3.

How should I resolve this?

Comments

  • I can not repro this; is of this morning, SLES's repos provide packages only for python 3.4, so the reported mismatch doesn't occur.

Sign In or Register to comment.