Bug 2280810

Summary: python-bash-kernel fails to build with Python 3.13: ModuleNotFoundError: No module named 'imghdr'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-bash-kernelAssignee: Jerry James <loganjerry>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, loganjerry, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-bash-kernel-0.9.3-4.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-10 20:23: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:
Bug Depends On:    
Bug Blocks: 2244836    

Description Karolina Surma 2024-05-16 11:44:28 UTC
python-bash-kernel fails to build with Python 3.13.0b1.

+ /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/bash_kernel-0.9.3/pyproject-wheeldir --output /builddir/build/BUILD/python-bash-kernel-0.9.3-3.fc41.x86_64-pyproject-buildrequires
Handling flit_core >=3.2,<4 from build-system.requires
Requirement satisfied: flit_core >=3.2,<4
   (installed: flit_core 3.9.0)
Handling pexpect (>=4.0) from get_requires_for_build_wheel
Requirement satisfied: pexpect (>=4.0)
   (installed: pexpect 4.9.0)
Handling ipykernel from get_requires_for_build_wheel
Requirement satisfied: ipykernel
   (installed: ipykernel 6.29.3)
/builddir/build/BUILD/bash_kernel-0.9.3/bash_kernel/kernel.py:130: SyntaxWarning: invalid escape sequence '\['
  ps1 = self.unique_prompt + u'\[\]' + ">"
/builddir/build/BUILD/bash_kernel-0.9.3/bash_kernel/kernel.py:131: SyntaxWarning: invalid escape sequence '\['
  ps2 = self.unique_prompt + u'\[\]' + "+"
/builddir/build/BUILD/bash_kernel-0.9.3/bash_kernel/kernel.py:134: SyntaxWarning: invalid escape sequence '\$'
  self.bashwrapper = IREPLWrapper(child, u'\$', prompt_change, self.unique_prompt,
/builddir/build/BUILD/bash_kernel-0.9.3/bash_kernel/display.py:1: SyntaxWarning: invalid escape sequence '\!'
  """display.py holds the functions needed to display different types of content.
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 560, in main
    generate_requires(
    ~~~~~~~~~~~~~~~~~^
        include_runtime=args.runtime,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
        config_settings=parse_config_settings_args(args.config_settings),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 461, in generate_requires
    generate_run_requirements(backend, requirements, build_wheel=build_wheel, wheeldir=wheeldir)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 367, in generate_run_requirements
    generate_run_requirements_hook(backend, requirements)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 308, in generate_run_requirements_hook
    dir_basename = prepare_metadata('.', config_settings=requirements.config_settings)
  File "/usr/lib/python3.13/site-packages/flit_core/buildapi.py", line 49, in prepare_metadata_for_build_wheel
    metadata = make_metadata(module, ini_info)
  File "/usr/lib/python3.13/site-packages/flit_core/common.py", line 425, in make_metadata
    md_dict.update(get_info_from_module(module, ini_info.dynamic_metadata))
                   ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/flit_core/common.py", line 222, in get_info_from_module
    docstring, version = get_docstring_and_version_via_import(target)
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/lib/python3.13/site-packages/flit_core/common.py", line 195, in get_docstring_and_version_via_import
    spec.loader.exec_module(m)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "<frozen importlib._bootstrap_external>", line 1021, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/builddir/build/BUILD/bash_kernel-0.9.3/bash_kernel/__init__.py", line 3, in <module>
    from .kernel import __version__
  File "/builddir/build/BUILD/bash_kernel-0.9.3/bash_kernel/kernel.py", line 18, in <module>
    from .display import (extract_contents, build_cmds)
  File "/builddir/build/BUILD/bash_kernel-0.9.3/bash_kernel/display.py", line 55, in <module>
    import imghdr
ModuleNotFoundError: No module named 'imghdr'

https://docs.python.org/3.13/whatsnew/3.13.html

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

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

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 1 Jerry James 2024-06-10 20:23:56 UTC
Upstream is working on a fix.  In the meantime, I added a patch to use filetype instead of imghdr.  I will remove that patch once upstream decides what to do and releases a new version.