Bug 2256746 - python-pint fails to build with Python 3.13: AttributeError: module 'importlib.resources' has no attribute 'path'
Summary: python-pint fails to build with Python 3.13: AttributeError: module 'importli...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pint
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthias Runge
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-01-04 10:29 UTC by Karolina Surma
Modified: 2024-01-05 12:15 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-01-05 12:15:58 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-01-04 10:29:16 UTC
python-pint fails to build with Python 3.13.0a2.


==================================== ERRORS ====================================
_______________ ERROR collecting pint/testsuite/test_testing.py ________________
pint/registry.py:639: in load_definitions
    parsed_files = p.parse(file, is_resource)
pint/parser.py:229: in parse
    parsed = self.parse_single_resource(file)
pint/parser.py:264: in parse_single_resource
    with resources.path(__package__, resource_name) as p:
E   AttributeError: module 'importlib.resources' has no attribute 'path'

During handling of the above exception, another exception occurred:
/usr/lib/python3.13/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.13/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.13/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.13/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.13/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.13/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3.13/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.13/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1381: in _gcd_import
    ???
<frozen importlib._bootstrap>:1354: in _find_and_load
    ???
<frozen importlib._bootstrap>:1325: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:929: in _load_unlocked
    ???
/usr/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
pint/testsuite/test_testing.py:16: in <module>
    Quantity(1, "m"),
pint/quantity.py:264: in __new__
    units = inst._REGISTRY.parse_units(units)._units
pint/registry.py:2356: in __getattr__
    self.__init()
pint/registry.py:2351: in __init
    self._after_init()
pint/registry.py:2018: in _after_init
    super()._after_init()
pint/registry.py:352: in _after_init
    loaded_files = self.load_definitions("default_en.txt", True)
pint/registry.py:644: in load_definitions
    raise ValueError("While opening {}\n{}".format(file, msg))
E   ValueError: While opening default_en.txt
E   module 'importlib.resources' has no attribute 'path'
=============================== warnings summary ===============================
pint/testsuite/helpers.py:125
pint/testsuite/helpers.py:125
pint/testsuite/helpers.py:125
pint/testsuite/helpers.py:125
  /builddir/build/BUILD/Pint-0.19.2/pint/testsuite/helpers.py:125: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    not LooseVersion(NUMPY_VER) >= LooseVersion(version),

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR pint/testsuite/test_testing.py - ValueError: While opening default_en.txt
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!


The deprecated importlib.resources methods were removed from Python 3.13:
- 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


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/06784090-python-pint/

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

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 Ben Beasley 2024-01-04 13:47:18 UTC
PR posted: https://src.fedoraproject.org/rpms/python-pint/pull-request/11

Allowing a little time for review.


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