Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1982668

Summary: Python *-wheel packages in RHEL 9 need to be versioned
Product: Red Hat Enterprise Linux 9 Reporter: Tomas Orsava <torsava>
Component: python3.9Assignee: Tomas Orsava <torsava>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: jkejda, lbalhar, mhroncok, pviktori, torsava
Target Milestone: betaKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3.9-3.9.9-2.el9 python-pip-21.2.3-5.el9 python-setuptools-53.0.0-8.el9 python-wheel-1:0.36.2-6.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-21 14:58:56 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:

Description Tomas Orsava 2021-07-15 11:54:15 UTC
In RHEL 8 and RHEL 9 we ship a few *-wheel packages, e.g. python-setuptools-wheel, python-pip-wheel, python-wheel-wheel.

In Fedora these packages install into an unversioned location `/usr/share/python-wheels` that is used by all Python versions. In RHEL, the support term is much longer, so in RHEL 8 we implemented versioned locations `/usr/share/pythonXY-wheels` for each Python stack separately.

In RHEL 9 we need to also implement versioned locations for wheels subpackages.

Comment 1 Miro Hrončok 2021-07-27 23:10:01 UTC
Tech notes:

In Fedora, python-{pip,setuptools,wheel}.spec has something like:

    %global python_wheeldir %{_datadir}/python-wheels

python3.10.spec has:

    --with-wheel-pkg-dir=%{_datadir}/python-wheels 

And python3.9.spec has (hard-coded in 00189-use-rpm-wheels.patch):

    _WHEEL_DIR = "/usr/share/python-wheels/"


We might adapt the spec files in Fedora to make the location centrally manageable: We would define %python_wheeldir in python-rpm-macros, use it in python-{pip,setuptools,wheel}.spec as well as python3.x.spec for x >= 10 (we can leave the patch in python3.9.spec as it is and let it eventually die).

In RHEL9+, we would define the %python_wheeldir macro to %{_datadir}/python%{python3_version}-wheels instead (and since we are still on Python 3.9, we would manually adapt 00189-use-rpm-wheels.patch).

Note that we need to keep the %python_wheeldir values in Fedora Rawhide and ELN in sync, otherwise ELN's Python would not work with Rawhide's wheels (or vice versa). We need to chnage the value of %python_wheeldir in RHEL only. In order not to need to redefine the macro over and over again in RHEL 10, 11, 12... we might use some more complex definition and share it across Fedora and RHEL spec, e.g. something like %{_datadir}/python%{?rhel:%{!?eln:%{python3_version}}}-wheels.

Note that python3.xx.spec in RHEL will need to manually define %{python3_version} to %{pybasever} for this to work. We can safely do that in Fedora as well.


Once we have all this ready in RHEL9, we might need to ship the 4 affeted packages via a side tag.

Once RHEL 10 bootstraps from ELN, we might see some build order issues, and we might need to be prepared to solve them.

Comment 2 Tomas Orsava 2021-08-11 10:58:49 UTC
Note that if we rename the python-wheel-wheel package, the name of the package might need to be updated in the comps list to continue pulling it into the CRB repo.

Comment 4 Lumír Balhar 2021-09-24 11:08:37 UTC
I haven't checked the pull requests but the packages from the copr work well for me and everything looks good.

Comment 5 Tomas Orsava 2021-09-29 11:04:13 UTC
The change is prepared and working in RHEL, but there is time, so I'd like to push it into Fedora first to get it tested there:

Fedora rawhide PRs:
• python-rpm-macros: https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/112
• python-wheel: https://src.fedoraproject.org/rpms/python-wheel/pull-request/23
• python-setuptools: https://src.fedoraproject.org/rpms/python-setuptools/pull-request/74
• python-pip: https://src.fedoraproject.org/rpms/python-pip/pull-request/94
• python3.10: https://src.fedoraproject.org/rpms/python3.10/pull-request/75

Fedora rawhide/35/ELN-buildroot testing copr: https://copr.fedorainfracloud.org/coprs/torsava/macronized-wheels/builds/

Comment 6 Miro Hrončok 2021-09-29 11:18:49 UTC
(In reply to Tomas Orsava from comment #5)
> The change is prepared and working in RHEL, but there is time, so I'd like
> to push it into Fedora first to get it tested there:
> 
> Fedora rawhide PRs:
> • python-rpm-macros:
> https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/112
> • python-wheel:
> https://src.fedoraproject.org/rpms/python-wheel/pull-request/23
> • python-setuptools:
> https://src.fedoraproject.org/rpms/python-setuptools/pull-request/74
> • python-pip: https://src.fedoraproject.org/rpms/python-pip/pull-request/94
> • python3.10: https://src.fedoraproject.org/rpms/python3.10/pull-request/75
> 
> Fedora rawhide/35/ELN-buildroot testing copr:
> https://copr.fedorainfracloud.org/coprs/torsava/macronized-wheels/builds/

Generally, the PRs (except python-rpm-macros) don't change anything, so the release bumps are not needed.

I would also like to see the python-virtualenv package changed to use the macros. That way, when I build it in https://copr.fedorainfracloud.org/coprs/churchyard/epel9-prep-work/ it should still work after this change lands in c9s.

Comment 7 Miro Hrončok 2021-09-29 11:20:47 UTC
Note that or virtualenv patch could use sysconfig.get_config_var('WHEEL_PKG_DIR') and only fallback to /usr/share/python-wheels when sysconfig.get_config_var('WHEEL_PKG_DIR') is not set. Since this evaluates on our main Python, is should be always set.

Comment 12 Miro Hrončok 2021-12-10 14:05:42 UTC
I also plan to test this with virtualenv in EPEL 9.

Comment 14 Miro Hrončok 2021-12-10 14:52:55 UTC
Packages from EPEL 9 / EPEL 9 Next and https://src.fedoraproject.org/rpms/python-virtualenv/pull-request/55

$ mock -r centos-stream-9-x86_64 install tree https://kojipkgs.fedoraproject.org//work/tasks/9951/79789951/python3-virtualenv-20.10.0-2.el9.next.noarch.rpm https://kojipkgs.fedoraproject.org//packages/python-platformdirs/2.3.0/2.el9.next/noarch/python3-platformdirs-2.3.0-2.el9.next.noarch.rpm https://kojipkgs.fedoraproject.org//packages/python-filelock/3.3.1/1.el9/noarch/python3-filelock-3.3.1-1.el9.noarch.rpm https://kojipkgs.fedoraproject.org//packages/python-distlib/0.3.2/1.el9/noarch/python3-distlib-0.3.2-1.el9.noarch.rpm
...
  Installing       : python3-setuptools-wheel-53.0.0-8.el9.noarch       1/12 
  Installing       : python3-pip-wheel-21.2.3-5.el9.noarch              2/12 
  Installing       : python3-wheel-wheel-1:0.36.2-6.el9.noarch          3/12 
  Installing       : expat-2.2.10-4.el9.x86_64                          4/12 
  Installing       : python3-3.9.9-2.el9.x86_64                         5/12 
  Installing       : python3-libs-3.9.9-2.el9.x86_64                    6/12 
  Installing       : python3-setuptools-53.0.0-8.el9.noarch             7/12 
  Installing       : python3-six-1.15.0-7.el9.noarch                    8/12 
  Installing       : python3-platformdirs-2.3.0-2.el9.next.noarch       9/12 
  Installing       : python3-filelock-3.3.1-1.el9.noarch               10/12 
  Installing       : python3-distlib-0.3.2-1.el9.noarch                11/12 
  Installing       : python3-virtualenv-20.10.0-2.el9.next.noarch      12/12 
...
$ mock -r centos-stream-9-x86_64 shell --unpriv
<mock-chroot> sh-5.1$ cd
<mock-chroot> sh-5.1$ virtualenv venv
created virtual environment CPython3.9.9.final.0-64 in 161ms
  creator CPython3Posix(dest=/builddir/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(extra_search_dir=/usr/share/python3-wheels,download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/builddir/.local/share/virtualenv)
    added seed packages: pip==21.2.3, setuptools==53.0.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
<mock-chroot> sh-5.1$ venv/bin/pip list
Package    Version
---------- -------
pip        21.2.3
setuptools 53.0.0
wheel      0.36.2
<mock-chroot> sh-5.1$ tree -L 4 venv 
venv
├── bin
│   ├── activate
│   ├── activate.csh
│   ├── activate.fish
│   ├── activate.nu
│   ├── activate.ps1
│   ├── activate_this.py
│   ├── deactivate.nu
│   ├── pip
│   ├── pip-3.9
│   ├── pip3
│   ├── pip3.9
│   ├── python -> /usr/bin/python3
│   ├── python3 -> python
│   ├── python3.9 -> python
│   ├── wheel
│   ├── wheel-3.9
│   ├── wheel3
│   └── wheel3.9
├── lib
│   └── python3.9
│       └── site-packages
│           ├── __pycache__
│           ├── _distutils_hack
│           ├── _virtualenv.pth
│           ├── _virtualenv.py
│           ├── distutils-precedence.pth
│           ├── pip
│           ├── pip-21.2.3.dist-info
│           ├── pip-21.2.3.virtualenv
│           ├── pkg_resources
│           ├── setuptools
│           ├── setuptools-53.0.0.dist-info
│           ├── setuptools-53.0.0.virtualenv
│           ├── wheel
│           ├── wheel-0.36.2.dist-info
│           └── wheel-0.36.2.virtualenv
├── lib64
│   └── python3.9
│       └── site-packages
└── pyvenv.cfg

16 directories, 25 files

Comment 15 Miro Hrončok 2021-12-10 14:54:33 UTC
And obligatory:

<mock-chroot> sh-5.1$ ls /usr/share/python3-wheels/
pip-21.2.3-py3-none-any.whl  setuptools-53.0.0-py3-none-any.whl  wheel-0.36.2-py2.py3-none-any.whl

<mock-chroot> sh-5.1$ ls /usr/share/python-wheels/
ls: cannot access '/usr/share/python-wheels/': No such file or directory