Bug 2246052

Summary: python-installer fails to build with Python 3.13: ImportError: cannot import name 'read_binary' from 'importlib.resources'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-installerAssignee: Karolina Surma <ksurma>
Status: CLOSED ERRATA QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, ksurma, mhroncok, python-packagers-sig, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-installer-0.7.0-4.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-01-11 13:09:25 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:
Bug Depends On:    
Bug Blocks: 2244836    

Description Karolina Surma 2023-10-25 07:42:32 UTC
python-installer fails to build with Python 3.13.0a1.

+ /usr/bin/python3 -sP /usr/lib/rpm/redhat/import_all_modules.py -f /builddir/build/BUILD/python-installer-0.7.0-3.fc40.x86_64-pyproject-modules
Check import: installer
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 171, in <module>
    main()
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 167, in main
    import_modules(modules)
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 100, in import_modules
    importlib.import_module(module)
  File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1008, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/builddir/build/BUILDROOT/python-installer-0.7.0-3.fc40.x86_64/usr/lib/python3.13/site-packages/installer/__init__.py", line 6, in <module>
    from installer._core import install  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILDROOT/python-installer-0.7.0-3.fc40.x86_64/usr/lib/python3.13/site-packages/installer/_core.py", line 7, in <module>
    from installer.destinations import WheelDestination
  File "/builddir/build/BUILDROOT/python-installer-0.7.0-3.fc40.x86_64/usr/lib/python3.13/site-packages/installer/destinations.py", line 19, in <module>
    from installer.scripts import Script
  File "/builddir/build/BUILDROOT/python-installer-0.7.0-3.fc40.x86_64/usr/lib/python3.13/site-packages/installer/scripts.py", line 6, in <module>
    from importlib.resources import read_binary
ImportError: cannot import name 'read_binary' from 'importlib.resources' (/usr/lib64/python3.13/importlib/resources/__init__.py)

https://docs.python.org/3.13/whatsnew/3.13.html
The read_binary method has been removed:

importlib.resources deprecated methods:
    contents()
    is_resource()
    open_binary()
    open_text()
    path()
    read_binary()
    read_text()

Use files() instead. Refer to importlib-resources: Migrating from Legacy for migration advice.
https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06546791-python-installer/

For all our attempts to build python-installer with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-installer/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 2 Fedora Update System 2024-01-11 13:08:41 UTC
FEDORA-2024-415cd6ecad has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2024-415cd6ecad

Comment 3 Fedora Update System 2024-01-11 13:09:25 UTC
FEDORA-2024-415cd6ecad has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.