Skip to content

MAINT: be more tolerant of setuptools>=60#20963

Merged
charris merged 1 commit intonumpy:mainfrom
ahesford:its-a-setup
Feb 1, 2022
Merged

MAINT: be more tolerant of setuptools>=60#20963
charris merged 1 commit intonumpy:mainfrom
ahesford:its-a-setup

Conversation

@ahesford
Copy link
Contributor

@ahesford ahesford commented Feb 1, 2022

NumPy may fail to build with the default vendored distutils in setuptools>=60. Rather than panic and die when new setuptools is found, let's check (or set, if possible) the SETUPTOOLS_USE_DISTUTILS environment variable that restores "proper" setuptools behavior.

We were bitten by #20759 and #20795 in Void Linux, which has already moved to setuptools>60.

Note that I cannot reproduce a build failure (at least not on maintenance/v.1.22.x) even when the new default isn't overridden. (That is, reverting #20759/#20795 is sufficient to allow NumPy to build for me.) However, in certain cases where it the new default might cause problems, this change should thread the needle. Sticking with setuptools < 60 for the next year while NumPy moves to a new build system is simply not a good option for Linux packagers.

NumPy may fail to build with the default vendored distutils in
setuptools>=60. Rather than panic and die when new setuptools is found,
let's check (or set, if possible) the SETUPTOOLS_USE_DISTUTILS
environment variable that restores "proper" setuptools behavior.
@mattip
Copy link
Member

mattip commented Feb 1, 2022

I am worried that setuptools will remove the SETUPTOOLS_USE_DISTUTILS shim, which will then break things. Have they committed to leaving it in place? Another alternative would be to import distutils and detect something that would indicate we are using the internal version.

@ahesford
Copy link
Contributor Author

ahesford commented Feb 1, 2022

Even if SETUPTOOLS_USE_DISTUTILS goes away, it weakens the constraints on setuptools and we can always add a hard limit later on if necessary.

Maybe a simple and sufficient test is to import distutils after setuptools (for versions >= 60) and check distutils.__path__ to see if it ends in setuptools/_distutils. On my system, switching SETUPTOOLS_USE_DISTUTILS will cause distutils.__path__ to change between $py3_lib/distutils and $py3_lib/setuptools/_distutils.

I would still like to know what build failures occur the vendors distutils, because I have not seen any problem building on Void with setuptools-60.5.0 whether or not I try to disable the vendored distutils.

@charris
Copy link
Member

charris commented Feb 1, 2022

The point of the check was to reduce reported issues due to using the wrong setuptools version. If this helps, lets give it a try until things break again.

@charris charris merged commit b6e6b83 into numpy:main Feb 1, 2022
@charris
Copy link
Member

charris commented Feb 1, 2022

Thanks @ahesford .

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Feb 1, 2022
@charris charris added this to the 1.22.3 release milestone Feb 1, 2022
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Feb 2, 2022
@charris charris removed this from the 1.22.3 release milestone Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants