あとがきのようなもの

インフラ関連,コンテナ,仮想化技術、過去に書いた記事の解説など

python36 moduleを無効にするとpipがインストールできない

ubi8-minimalを使ったコンテナイメージの容量削減の試行錯誤で確認。RHEL 8.xでも同様と想定される。

  • dnfでpython39python3-pipをインストールするとpython36とpython39 moduleが有効になっている
  • dnf install前にpython36 moduleを無効にするとpipがインストールできない

再現

(下記作業はubi8-minimalコンテナ内)

通常通りpython39python3-pipをインストール

[root@8f3c12facb9f /]# microdnf install --disableplugin=subscription-manager --nodocs -y python39 python3-pip

出力結果を開く

Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                                                        Repository                                               Size
Installing:
 gdbm-1:1.18-1.el8.x86_64                                                                                                                      ubi-8-baseos                                         132.9 kB
 gdbm-libs-1:1.18-1.el8.x86_64                                                                                                                 ubi-8-baseos                                          62.0 kB
 libnsl2-1.2.0-2.20180605git4a062cf.el8.x86_64                                                                                                 ubi-8-baseos                                          59.1 kB
 libtirpc-1.1.4-4.el8.x86_64                                                                                                                   ubi-8-baseos                                         115.5 kB
 platform-python-3.6.8-37.el8.x86_64                                                                                                           ubi-8-baseos                                          86.1 kB
 platform-python-pip-9.0.3-19.el8.noarch                                                                                                       ubi-8-baseos                                           1.8 MB
 platform-python-setuptools-39.2.0-6.el8.noarch                                                                                                ubi-8-baseos                                         647.5 kB
 python3-libs-3.6.8-37.el8.x86_64                                                                                                              ubi-8-baseos                                           8.2 MB
 python3-pip-9.0.3-19.el8.noarch                                                                                                               ubi-8-appstream                                       20.2 kB
 python3-pip-wheel-9.0.3-19.el8.noarch                                                                                                         ubi-8-baseos                                           1.1 MB
 python3-setuptools-39.2.0-6.el8.noarch                                                                                                        ubi-8-baseos                                         166.5 kB
 python3-setuptools-wheel-39.2.0-6.el8.noarch                                                                                                  ubi-8-baseos                                         295.8 kB
 python36-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64                                                                                          ubi-8-appstream                                       19.6 kB
 python39-3.9.2-1.module+el8.4.0+10237+bdc77aac.x86_64                                                                                         ubi-8-appstream                                       32.8 kB
 python39-libs-3.9.2-1.module+el8.4.0+10237+bdc77aac.x86_64                                                                                    ubi-8-appstream                                        8.5 MB
 python39-pip-20.2.4-3.module+el8.4.0+9822+20bf1249.noarch                                                                                     ubi-8-appstream                                        2.1 MB
 python39-pip-wheel-20.2.4-3.module+el8.4.0+9822+20bf1249.noarch                                                                               ubi-8-appstream                                        1.3 MB
 python39-setuptools-50.3.2-3.module+el8.4.0+9822+20bf1249.noarch                                                                              ubi-8-appstream                                      891.6 kB
 python39-setuptools-wheel-50.3.2-3.module+el8.4.0+9822+20bf1249.noarch                                                                        ubi-8-appstream                                      508.5 kB
Transaction Summary:
 Installing:       19 packages
 Reinstalling:      0 packages
 Upgrading:         0 packages
 Obsoleting:        0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Enabling module streams:
    python36:3.6
    python39:3.9


Downloading packages...
Running transaction test...
Installing: libtirpc;1.1.4-4.el8;x86_64;ubi-8-baseos
Installing: gdbm-libs;1:1.18-1.el8;x86_64;ubi-8-baseos
Installing: libnsl2;1.2.0-2.20180605git4a062cf.el8;x86_64;ubi-8-baseos
Installing: python3-pip-wheel;9.0.3-19.el8;noarch;ubi-8-baseos
Installing: python3-setuptools-wheel;39.2.0-6.el8;noarch;ubi-8-baseos
Installing: gdbm;1:1.18-1.el8;x86_64;ubi-8-baseos
Installing: platform-python-pip;9.0.3-19.el8;noarch;ubi-8-baseos
Installing: python3-libs;3.6.8-37.el8;x86_64;ubi-8-baseos
Installing: platform-python;3.6.8-37.el8;x86_64;ubi-8-baseos
Installing: platform-python-setuptools;39.2.0-6.el8;noarch;ubi-8-baseos
Installing: python3-setuptools;39.2.0-6.el8;noarch;ubi-8-baseos
Installing: python3-pip;9.0.3-19.el8;noarch;ubi-8-appstream
Installing: python36;3.6.8-2.module+el8.1.0+3334+5cb623d7;x86_64;ubi-8-appstream
Installing: python39-pip-wheel;20.2.4-3.module+el8.4.0+9822+20bf1249;noarch;ubi-8-appstream
Installing: python39-setuptools-wheel;50.3.2-3.module+el8.4.0+9822+20bf1249;noarch;ubi-8-appstream
Installing: python39-libs;3.9.2-1.module+el8.4.0+10237+bdc77aac;x86_64;ubi-8-appstream
Installing: python39;3.9.2-1.module+el8.4.0+10237+bdc77aac;x86_64;ubi-8-appstream
Installing: python39-setuptools;50.3.2-3.module+el8.4.0+9822+20bf1249;noarch;ubi-8-appstream
Installing: python39-pip;20.2.4-3.module+el8.4.0+9822+20bf1249;noarch;ubi-8-appstream
Complete.

  • python36とpython39 moduleが有効化されている
Enabling module streams:
    python36:3.6
    python39:3.9

python36 moduleを無効化してpython39python3-pipをインストール

[root@4fdfe700d1a3 /]# microdnf module disable python36

(microdnf:6): librhsm-WARNING **: 17:33:05.542: Found 0 entitlement certificates

(microdnf:6): librhsm-WARNING **: 17:33:05.544: Found 0 entitlement certificates
Downloading metadata...
Downloading metadata...
Downloading metadata...
Disabling modules:
    python36


Running transaction test...
[root@4fdfe700d1a3 /]# microdnf install --disableplugin=subscription-manager --nodocs -y python39 python3-pip
error: Could not depsolve transaction; 1 problem detected:
 Problem: package python3-pip-9.0.3-19.el8.noarch requires /usr/bin/python3.6, but none of the providers can be installed
  - package python3-pip-9.0.3-19.el8.noarch requires python36, but none of the providers can be installed
  - conflicting requests
  - package python36-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64 is filtered out by modular filtering
  • エラーになってインストールができない

python36 moduleを有効化して再度python39python3-pipをインストール

[root@4fdfe700d1a3 /]# microdnf module enable python36

出力結果を開く

(microdnf:56): librhsm-WARNING **: 17:33:59.636: Found 0 entitlement certificates

(microdnf:56): librhsm-WARNING **: 17:33:59.637: Found 0 entitlement certificates
Enabling module streams:
    python36:3.6


Running transaction test...
[root@4fdfe700d1a3 /]# microdnf install --disableplugin=subscription-manager --nodocs -y python39 python3-pip
Package                                                                                                                                        Repository                                               Size
Installing:
 gdbm-1:1.18-1.el8.x86_64                                                                                                                      ubi-8-baseos                                         132.9 kB
 gdbm-libs-1:1.18-1.el8.x86_64                                                                                                                 ubi-8-baseos                                          62.0 kB
 libnsl2-1.2.0-2.20180605git4a062cf.el8.x86_64                                                                                                 ubi-8-baseos                                          59.1 kB
 libtirpc-1.1.4-4.el8.x86_64                                                                                                                   ubi-8-baseos                                         115.5 kB
 platform-python-3.6.8-37.el8.x86_64                                                                                                           ubi-8-baseos                                          86.1 kB
 platform-python-pip-9.0.3-19.el8.noarch                                                                                                       ubi-8-baseos                                           1.8 MB
 platform-python-setuptools-39.2.0-6.el8.noarch                                                                                                ubi-8-baseos                                         647.5 kB
 python3-libs-3.6.8-37.el8.x86_64                                                                                                              ubi-8-baseos                                           8.2 MB
 python3-pip-9.0.3-19.el8.noarch                                                                                                               ubi-8-appstream                                       20.2 kB
 python3-pip-wheel-9.0.3-19.el8.noarch                                                                                                         ubi-8-baseos                                           1.1 MB
 python3-setuptools-39.2.0-6.el8.noarch                                                                                                        ubi-8-baseos                                         166.5 kB
 python3-setuptools-wheel-39.2.0-6.el8.noarch                                                                                                  ubi-8-baseos                                         295.8 kB
 python36-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64                                                                                          ubi-8-appstream                                       19.6 kB
 python39-3.9.2-1.module+el8.4.0+10237+bdc77aac.x86_64                                                                                         ubi-8-appstream                                       32.8 kB
 python39-libs-3.9.2-1.module+el8.4.0+10237+bdc77aac.x86_64                                                                                    ubi-8-appstream                                        8.5 MB
 python39-pip-20.2.4-3.module+el8.4.0+9822+20bf1249.noarch                                                                                     ubi-8-appstream                                        2.1 MB
 python39-pip-wheel-20.2.4-3.module+el8.4.0+9822+20bf1249.noarch                                                                               ubi-8-appstream                                        1.3 MB
 python39-setuptools-50.3.2-3.module+el8.4.0+9822+20bf1249.noarch                                                                              ubi-8-appstream                                      891.6 kB
 python39-setuptools-wheel-50.3.2-3.module+el8.4.0+9822+20bf1249.noarch                                                                        ubi-8-appstream                                      508.5 kB
Transaction Summary:
 Installing:       19 packages
 Reinstalling:      0 packages
 Upgrading:         0 packages
 Obsoleting:        0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Enabling module streams:
    python39:3.9


Downloading packages...
Running transaction test...
Installing: libtirpc;1.1.4-4.el8;x86_64;ubi-8-baseos
Installing: gdbm-libs;1:1.18-1.el8;x86_64;ubi-8-baseos
Installing: libnsl2;1.2.0-2.20180605git4a062cf.el8;x86_64;ubi-8-baseos
Installing: python3-pip-wheel;9.0.3-19.el8;noarch;ubi-8-baseos
Installing: python3-setuptools-wheel;39.2.0-6.el8;noarch;ubi-8-baseos
Installing: gdbm;1:1.18-1.el8;x86_64;ubi-8-baseos
Installing: platform-python-pip;9.0.3-19.el8;noarch;ubi-8-baseos
Installing: python3-libs;3.6.8-37.el8;x86_64;ubi-8-baseos
Installing: platform-python;3.6.8-37.el8;x86_64;ubi-8-baseos
Installing: platform-python-setuptools;39.2.0-6.el8;noarch;ubi-8-baseos
Installing: python3-setuptools;39.2.0-6.el8;noarch;ubi-8-baseos
Installing: python3-pip;9.0.3-19.el8;noarch;ubi-8-appstream
Installing: python36;3.6.8-2.module+el8.1.0+3334+5cb623d7;x86_64;ubi-8-appstream
Installing: python39-pip-wheel;20.2.4-3.module+el8.4.0+9822+20bf1249;noarch;ubi-8-appstream
Installing: python39-setuptools-wheel;50.3.2-3.module+el8.4.0+9822+20bf1249;noarch;ubi-8-appstream
Installing: python39-libs;3.9.2-1.module+el8.4.0+10237+bdc77aac;x86_64;ubi-8-appstream
Installing: python39;3.9.2-1.module+el8.4.0+10237+bdc77aac;x86_64;ubi-8-appstream
Installing: python39-setuptools;50.3.2-3.module+el8.4.0+9822+20bf1249;noarch;ubi-8-appstream
Installing: python39-pip;20.2.4-3.module+el8.4.0+9822+20bf1249;noarch;ubi-8-appstream
Complete.

  • python39 moduleが追加で有効化され、無事インストールが完了