Skip to content

Python3.12: distutils have been removed from stdlib #1240

@penguinpee

Description

@penguinpee

Fedora has recently updated Python to 3.12 in rawhide (development branch). As a result distutils is no longer in the standard lib:

==================================== ERRORS ====================================
_________________ ERROR collecting nisext/tests/test_sexts.py __________________
ImportError while importing test module '/builddir/build/BUILD/nibabel-5.1.0/nisext/tests/test_sexts.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
nisext/tests/test_sexts.py:9: in <module>
    from ..sexts import package_check
nisext/sexts.py:5: in <module>
    from distutils import log
E   ModuleNotFoundError: No module named 'distutils'
=============================== warnings summary ===============================

I had a go add patching sexts.py and will provide a PR shortly. However, after having tests working again, a bunch of them (test_from_file_url, test_write_mgh, test_filename_exts, test_big_offset_exts, test_load_save) failed. I disabled these for the time being since I don't have the time and knowledge to analyze these.

Please let me know if you'd like me to open a separate issue for tests failing in Python3.12. Of course, (some of) the failures could also be due to the Fedora build environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions