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 1868006 - python38: Support for alternative architectures' names in Python importlib
Summary: python38: Support for alternative architectures' names in Python importlib
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: python38
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: beta
: 8.4
Assignee: Lumír Balhar
QA Contact: Lukáš Zachar
URL:
Whiteboard:
Depends On: 1868003
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-11 11:50 UTC by Lumír Balhar
Modified: 2021-05-18 15:54 UTC (History)
4 users (show)

Fixed In Version: python38-3.8.6-2.module+el8.4.0+9001+fc421f6c
Doc Type: No Doc Update
Doc Text:
Clone Of: 1868003
Environment:
Last Closed: 2021-05-18 15:53:56 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Lumír Balhar 2020-08-11 11:50:48 UTC
+++ This bug was initially created as a clone of Bug #1868003 +++

I have recently discovered that our Pythons in Fedora and RHEL are configured in a different way than upstream and some other distributions. The difference is in names for some architectures — for example, for 64 bit PowerPC, Fedora and RHEL use "ppc64" but CPython upstream, Debian, SUSE, etc. use "powerpc64".

This difference causes trouble with universal manylinux wheels. For example, simple-manylinux-demo produces a wheel for PowerPC with a built extension module. The module has powerpc64le in its name and therefore Python interpreters on RHEL cannot find it and import it.

The plan is to patch all Python interpreters in RHEL to be compatible with the upstream and downstream names at the same time and then we will remove the patch causing the difference.

This is already fixed in Fedora, for example https://src.fedoraproject.org/rpms/python3.9/c/898f7432fb5857a33df7360d48aff9f8fcba03f8?branch=master

Further reading: https://github.com/pypa/manylinux/issues/687

Comment 1 Petr Viktorin (pviktori) 2020-08-12 12:21:47 UTC
To test this, install and run the third-party Numpy package on ppc64le. The test currently exists (I'm not sure where) but is failing.

Comment 2 Lumír Balhar 2020-08-13 06:27:36 UTC
This can wait for RHEL 8.4.0 because it needs some time in Fedora first.

The change is ready in https://src.osci.redhat.com/rpms/python38/c/39c2cf50cf9227125068160bdf0aac901cf8e90f?branch=private-lbalhar-stream-3.8-rhel-8.4.0
Scratch build: https://mbsweb.engineering.redhat.com/module/7653

Verification:

old:

# python3.8 -c "import sys; print(sys.path_importer_cache['/usr/lib64/python3.8']._loaders)"
[('.cpython-38-ppc64le-linux-gnu.so', <class '_frozen_importlib_external.ExtensionFileLoader'>), ('.abi3.so', <class '_frozen_importlib_external.ExtensionFileLoader'>), ('.so', <class '_frozen_importlib_external.ExtensionFileLoader'>), ('.py', <class '_frozen_importlib_external.SourceFileLoader'>), ('.pyc', <class '_frozen_importlib_external.SourcelessFileLoader'>)]

new:

# python3.8 -c "import sys; print(sys.path_importer_cache['/usr/lib64/python3.8']._loaders)"
[('.cpython-38-ppc64le-linux-gnu.so', <class '_frozen_importlib_external.ExtensionFileLoader'>), ('.abi3.so', <class '_frozen_importlib_external.ExtensionFileLoader'>), ('.so', <class '_frozen_importlib_external.ExtensionFileLoader'>), ('.cpython-38-powerpc64le-linux-gnu.so', <class '_frozen_importlib_external.ExtensionFileLoader'>), ('.py', <class '_frozen_importlib_external.SourceFileLoader'>), ('.pyc', <class '_frozen_importlib_external.SourcelessFileLoader'>)]

# pip3.8 install simple.manylinux-demo
# python3.8 -m unittest discover dummyextension.tests
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

Comment 5 Lumír Balhar 2020-11-03 10:48:34 UTC
The change is ready but untested in https://src.osci.redhat.com/rpms/python38/c/c3c61d86034bad1237818a45a5cd691aff301f5c?branch=private-lbalhar-stream-3.8-rhel-8.4.0

I cannot test it because I cannot rebuild Python 38 module because of a problem with dependencies collision between baseos and the module described in https://projects.engineering.redhat.com/browse/RHELBLD-3128

Comment 6 Lumír Balhar 2020-12-02 08:41:42 UTC
Module scratch build: https://mbsweb.engineering.redhat.com/module/8914
Python 3.8 component: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=33406200

PR: https://src.osci.redhat.com/rpms/python38/pull-request/5

Verification:

Old version (python38-3.8.3-3.module+el8.3.0+7680+79e7e61a.ppc64le)

# python3.8 -m venv venv
source venv/bin/activate
# source venv/bin/activate
(venv) # pip install -U pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/55/73/bce122d1ed0217b3c1a3439ab16dfa94bbeabd0d31755fcf907493abf39b/pip-20.3-py2.py3-none-any.whl (1.5MB)
     |████████████████████████████████| 1.5MB 1.8MB/s 
Installing collected packages: pip
  Found existing installation: pip 19.3.1
    Uninstalling pip-19.3.1:
      Successfully uninstalled pip-19.3.1
Successfully installed pip-20.3
(venv) # pip install simple-manylinux-demo
Collecting simple-manylinux-demo
  Downloading simple_manylinux_demo-1.0-cp38-cp38-manylinux2014_ppc64le.whl (17 kB)
Installing collected packages: simple-manylinux-demo
Successfully installed simple-manylinux-demo-1.0
(venv) # ls -la venv/lib/python3.8/site-packages/dummyextension/
total 120
drwxr-xr-x.  4 root root  4096 Dec  2 08:28 .
drwxr-xr-x. 10 root root  4096 Dec  2 08:28 ..
-rw-r--r--.  1 root root     0 Dec  2 08:28 __init__.py
drwxr-xr-x.  2 root root  4096 Dec  2 08:28 __pycache__
-rwxr-xr-x.  1 root root 89176 Dec  2 08:28 extension.cpython-38-powerpc64le-linux-gnu.so
drwxr-xr-x.  3 root root  4096 Dec  2 08:28 tests
(venv) # python
Python 3.8.3 (default, Aug 18 2020, 12:58:59) 
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from dummyextension import extension
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'extension' from 'dummyextension' (/venv/lib64/python3.8/site-packages/dummyextension/__init__.py)
>>> import sysconfig
>>> sysconfig.get_config_var("EXT_SUFFIX")
'.cpython-38-ppc64le-linux-gnu.so'

New version (python38-3.8.6-2.scrmod+el8.4.0+8900+a7d53920.ppc64le)

# python3.8 -m venv venv
# source venv/bin/activate
(venv) # pip install -U pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/55/73/bce122d1ed0217b3c1a3439ab16dfa94bbeabd0d31755fcf907493abf39b/pip-20.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.3.1
    Uninstalling pip-19.3.1:
      Successfully uninstalled pip-19.3.1
Successfully installed pip-20.3
(venv) # pip install simple-manylinux-demo
Collecting simple-manylinux-demo
  Using cached simple_manylinux_demo-1.0-cp38-cp38-manylinux2014_ppc64le.whl (17 kB)
Installing collected packages: simple-manylinux-demo
Successfully installed simple-manylinux-demo-1.0
(venv) # python
Python 3.8.6 (default, Dec  1 2020, 07:56:20) 
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from dummyextension import extension
>>> import sysconfig
>>> sysconfig.get_config_var("EXT_SUFFIX")
'.cpython-38-ppc64le-linux-gnu.so'
>>> 
(venv) # git clone https://github.com/frenzymadness/simple-manylinux-demo.git
(venv) # cd simple-manylinux-demo/
(venv) # python setup.py build
(venv) # ls -la build
total 32
drwxr-xr-x. 4 root root 4096 Dec  2 08:33 .
drwxr-xr-x. 5 root root 4096 Dec  2 08:33 ..
drwxr-xr-x. 3 root root 4096 Dec  2 08:33 lib.linux-ppc64le-3.8
drwxr-xr-x. 3 root root 4096 Dec  2 08:33 temp.linux-ppc64le-3.8
(venv) # ls -la build/lib.linux-ppc64le-3.8/dummyextension/
total 56
drwxr-xr-x. 3 root root  4096 Dec  2 08:33 .
drwxr-xr-x. 3 root root  4096 Dec  2 08:33 ..
-rw-r--r--. 1 root root     0 Dec  2 08:33 __init__.py
-rwxr-xr-x. 1 root root 89368 Dec  2 08:33 extension.cpython-38-ppc64le-linux-gnu.so
drwxr-xr-x. 2 root root  4096 Dec  2 08:33 tests

(venv) # PYTHONPATH=build/lib.linux-ppc64le-3.8/dummyextension/ python
Python 3.8.6 (default, Dec  1 2020, 07:56:20) 
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import extension
>>>

Comment 7 Lumír Balhar 2020-12-03 09:40:49 UTC
The PR is merged. I'm gonna rebuild the module together with other fixes later.

Comment 13 errata-xmlrpc 2021-05-18 15:53:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: python38:3.8 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:1879


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