Replace distutils usage for Python 3.12 compatibility#402
Open
LeSingh1 wants to merge 1 commit into
Open
Conversation
numpy<1.24 transitively requires distutils, which was removed from Python 3.12. The repo doesn't use any numpy 1.24+ deprecated aliases (np.float_, np.bool_, np.int_, etc. — grep confirms zero matches), so the upper bound is no longer needed. Removing it lets pip resolve a modern numpy (which no longer depends on distutils) and unblocks installation on Python 3.12+. Fixes apple#388
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #388. The repo doesn't import
distutilsdirectly — the dependency comes in transitively through thenumpy<1.24pin insetup.py. NumPy versions older than 1.24 importdistutilsinternally, which Python 3.12 removed from the stdlib. Sopip install .fails on Python 3.12.This relaxes the upper bound to allow a modern numpy. NumPy 1.24+ no longer touches
distutils, so the install path becomes 3.12-compatible.Safety check
Searched the codebase for any of the numpy aliases removed in 1.24 (
np.float_,np.bool_,np.int_,np.complex_,np.object_,np.str_,np.long):All numpy usage in the project sticks to explicit-bit-width types (
np.float16,np.float32,np.int32) which are stable across the 1.24 → 2.x transition. Sibling pinned deps (coremltools>=8.0,diffusers[torch]==0.30.2,transformers==4.44.2,torch) all support modern numpy.Test plan
python3 -c "import ast; ast.parse(open('setup.py').read())"— setup.py still valid Python.*.py— zero matches.Scope
One-line change. I intentionally did not touch the CMake/Python-detection/wheel-naming items from #2376; they need separate consideration and were called out as needing maintainer discussion.
Risks / follow-ups
numpy<3.0would still cover both1.24+and2.xand unblock 3.12. Happy to switch.Programming Language :: Python :: 3.7/3.8/3.9classifiers insetup.pyare now stale (3.7 and 3.8 are EOL upstream). Not touched in this PR.