Bug 2325443

Summary: python-pydicom fails to build with Python 3.14: ImportError: cannot import name 'ByteString' from 'collections.abc'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-pydicomAssignee: Ankur Sinha (FranciscoD) <sanjay.ankur>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: igor.raits, ksurma, mhroncok, neuro-sig, sanjay.ankur
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pydicom-3.0.1-7.fc42 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-11-18 10:47:27 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: 2322407    

Description Karolina Surma 2024-11-12 12:13:29 UTC
python-pydicom fails to build with Python 3.14.0a1.

Check import: pydicom
Traceback (most recent call last):
 ...
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/__init__.py", line 31, in <module>
    from pydicom.dataelem import DataElement
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/dataelem.py", line 17, in <module>
    from pydicom import config  # don't import datetime_conversion directly
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/config.py", line 407, in <module>
    import pydicom.pixel_data_handlers.numpy_handler as np_handler  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/pixel_data_handlers/__init__.py", line 6, in <module>
    from pydicom.pixels.processing import (
    ...<6 lines>...
    )
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/pixels/__init__.py", line 3, in <module>
    from pydicom.pixels.decoders.base import get_decoder
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/pixels/decoders/__init__.py", line 3, in <module>
    from pydicom.pixels.decoders.base import (
    ...<16 lines>...
    )
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/pixels/decoders/base.py", line 21, in <module>
    from pydicom.pixels.common import (
    ...<5 lines>...
    )
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/pixels/common.py", line 9, in <module>
    from pydicom.pixels.utils import as_pixel_options
  File "/builddir/build/BUILD/python-pydicom-3.0.1-build/BUILDROOT/usr/lib/python3.14/site-packages/pydicom/pixels/utils.py", line 4, in <module>
    from collections.abc import Iterable, Iterator, ByteString
ImportError: cannot import name 'ByteString' from 'collections.abc' (/usr/lib64/python3.14/_collections_abc.py)

According to https://docs.python.org/dev/whatsnew/3.14.html#typing

ByteString has been removed from both typing and collections.abc modules.
It had previously raised a DeprecationWarning since Python 3.12.


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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08211197-python-pydicom/

For all our attempts to build python-pydicom with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-pydicom/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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 Ankur Sinha (FranciscoD) 2024-11-12 12:25:41 UTC
Filed issue upstream to begin with: https://github.com/pydicom/pydicom/issues/2172

Comment 2 Fedora Update System 2024-11-18 10:43:53 UTC
FEDORA-2024-c035e0adc7 (python-pydicom-3.0.1-7.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-c035e0adc7

Comment 3 Fedora Update System 2024-11-18 10:47:27 UTC
FEDORA-2024-c035e0adc7 (python-pydicom-3.0.1-7.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.