Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
penguinpee opened this issue Jul 17, 2023 · 3 comments
Closed

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

penguinpee opened this issue Jul 17, 2023 · 3 comments

Comments

@penguinpee
Copy link
Contributor

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.

penguinpee added a commit to penguinpee/nibabel that referenced this issue Jul 17, 2023
`distutils' have been removed from Python stdlib (nipy#1240).
@effigies
Copy link
Member

effigies commented Jul 17, 2023

The patch is just to remove nisext. It is deprecated and will be removed in the next major release. We're being conservative and giving people time to remove it on the off chance anybody is using it, but you don't have to be.

@penguinpee
Copy link
Contributor Author

penguinpee commented Jul 17, 2023

I saw that warning. And that is certainly one way forward. Since we have nisext packaged currently, it's hard for me to tell, who may be using it. So, in that way we are kind of conservative as well. But seeing that this is currently an issue in rawhide, aka next release, we may as well remove it and let people know. The stable branches still have it, and will keep it, unless something else breaks.

However, the current release is still 5.1.0 and that should still build in Python3.12. I'm totally find with you not putting any effort in fixing that with plans to remove nisext from the next major release. Is there a ball park figure when the next major release will be ready?

Regarding the failing tests since upgrading to Python3.12, would you like me to open a separate issue? I could also hold off on it and have someone with better knowledge of nibabel look into them on our end first or simply wait until next release and take it from there.

@effigies
Copy link
Member

I saw that warning. And that is certainly one way forward. Since we have nisext packaged currently, it's hard for me to tell, who may be using it. So, in that way we are kind of conservative as well. But seeing that this is currently an issue in rawhide, aka next release, we may as well remove it and let people know. The stable branches still have it, and will keep it, unless something else breaks.

Yeah, I would recommend removing it and see if anything breaks. I highly doubt it. The only places I could find it from a tedious search through GitHub is in copies of nibabel vendored into other projects and a couple lines in the dipy Makefile that have since been removed.

However, the current release is still 5.1.0 and that should still build in Python3.12. I'm totally find with you not putting any effort in fixing that with plans to remove nisext from the next major release. Is there a ball park figure when the next major release will be ready?

We try to go yearly, so I think 6 will be early next year. There's a decent chance of a 5.2, but practically none of a 5.3.

Regarding the failing tests since upgrading to Python3.12, would you like me to open a separate issue? I could also hold off on it and have someone with better knowledge of nibabel look into them on our end first or simply wait until next release and take it from there.

When numpy starts putting out 3.12 nightly wheels, we'll start testing. I haven't checked in a couple weeks, so that might be ready to go. Feel free to open issues for ones you've already found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants