-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Restore local distutils as the default. #2896
Conversation
I have not seen the status of https://github.com/pypa/distutils/milestone/1 so I will basically just report the status of Fedora:
As a side note, we will most likely not be able to change RHEL/EPEL at all. That is a dead-end and I assume we are on our own there. If the setuptools version that switches to local distutils also drops Python 3.6 support, we would be happy. We could:
I assume that you are not willing to do (1) or (2), so I can definitively look at (3). Our legacy distutils patch is fedora-python/cpython@42d0bdb#diff-ad882d2747b67da1f6b5a8d3a08f0865ee7bb9fd88c4e8e3ff946d338606e818 Would you take that, guarded by something like |
One important distinction is that distutils still relies on the
That's do-able.
Have you considered in these older environments to recommend/force setting |
I wonder how. Setting that environment variable when Python starts? Also, I assume eventually, this would stop being a possibility, right? |
I don't have any particular opinion. It would need to happen before
Eventually, probably around Python 3.9 EOL, but of course we'll strive to provide a smooth transition. |
Hi! Sorry for the perhaps naive question, but what is the best way for me to test this? |
@0-wiz-0 you could use |
Or, since all this change does is make local distutils the default, you can simply set But most important is to use setuptools >= 59.2 as that's the one that's needed to honor platform-specific hooks. |
Also need to incorporate mingw/cygwin distutil patches - see pypa/distutils#60 (comment), pypa/distutils#60 (comment); |
Just checking: does this go into |
As currently written, the |
From Homebrew's side we completely override the prefix ( We currently do this via Going forward we're looking at the system that will hopefully be introduced in Python 3.11 to add additional install schemes to sysconfig.py: Notably, the idea is schemes should be added rather than replaced. This is why While the above will cover Python 3.10+, there'll still be a question about what we do for <= 3.9. |
…s instead of using the one in setuptools 0.60. See pypa/setuptools#2896 See #4510
With v60.0.0 setuptools started monkeypatching the distuils module to use their own vendored version. Longterm any uses of distuils should be replaced or removed. pypa/setuptools#2896
The change in pypa/setuptools#2896 seems to have broken all our builds.
The change in pypa/setuptools#2896 seems to have broken all our dxtbx github builds.
So, it seems that while this is solved wrt our That means, users who run setuptools 60+ on Fedora with Python 3.7 or 3.8 might experience weirdness, as described in for example in pylint-dev/pylint#5704 |
I've opened pypa/distutils#110 |
Setuptools v60 and later include a bundled version of distutils, a deprecated standard library scheduled for removal in future versions of Python. Setuptools v60 is only possible to install for Python 3.7 and later. Python has a distutils.sysconfig.get_python_lib() function that returns '/usr/lib/pythonX.Y' on posix systems. RPM-based systems actually use '/usr/lib64/pythonX.Y' instead, so Fedora patches stdlib distutils for Python 3.7 and Python 3.8 to return the correct value. Python 3.9 and later introduce a sys.platlibdir property, which returns the correct value on RPM-based systems. The change to a distutils package not provided by Fedora on Python 3.7 and 3.8 causes a regression in distutils.sysconfig.get_python_lib() that ultimately causes false positives to be emitted by pylint, because it can no longer find the system source libraries. Many Python tools are fairly aggressive about updating setuptools packages, and so even though this package is a fair bit newer than Python 3.7/3.8, it's not entirely unreasonable for a given user to have such a modern package with a fairly old Python interpreter. Updates to Python 3.7 and Python 3.8 are being produced for Fedora which will fix the problem on up-to-date systems. Until then, we can force the loading of platform-provided distutils when running the pylint test. This is the least-invasive yet most comprehensive fix. References: pypa/setuptools#2896 pylint-dev/pylint#5704 pypa/distutils#110 Signed-off-by: John Snow <[email protected]> Message-id: [email protected] Signed-off-by: John Snow <[email protected]>
Setuptools v60 and later include a bundled version of distutils, a deprecated standard library scheduled for removal in future versions of Python. Setuptools v60 is only possible to install for Python 3.7 and later. Python has a distutils.sysconfig.get_python_lib() function that returns '/usr/lib/pythonX.Y' on posix systems. RPM-based systems actually use '/usr/lib64/pythonX.Y' instead, so Fedora patches stdlib distutils for Python 3.7 and Python 3.8 to return the correct value. Python 3.9 and later introduce a sys.platlibdir property, which returns the correct value on RPM-based systems. The change to a distutils package not provided by Fedora on Python 3.7 and 3.8 causes a regression in distutils.sysconfig.get_python_lib() that ultimately causes false positives to be emitted by pylint, because it can no longer find the system source libraries. Many Python tools are fairly aggressive about updating setuptools packages, and so even though this package is a fair bit newer than Python 3.7/3.8, it's not entirely unreasonable for a given user to have such a modern package with a fairly old Python interpreter. Updates to Python 3.7 and Python 3.8 are being produced for Fedora which will fix the problem on up-to-date systems. Until then, we can force the loading of platform-provided distutils when running the pylint test. This is the least-invasive yet most comprehensive fix. References: pypa/setuptools#2896 pylint-dev/pylint#5704 pypa/distutils#110 Signed-off-by: John Snow <[email protected]> Message-id: [email protected] Signed-off-by: John Snow <[email protected]>
Setuptools v60 and later include a bundled version of distutils, a deprecated standard library scheduled for removal in future versions of Python. Setuptools v60 is only possible to install for Python 3.7 and later. Python has a distutils.sysconfig.get_python_lib() function that returns '/usr/lib/pythonX.Y' on posix systems. RPM-based systems actually use '/usr/lib64/pythonX.Y' instead, so Fedora patches stdlib distutils for Python 3.7 and Python 3.8 to return the correct value. Python 3.9 and later introduce a sys.platlibdir property, which returns the correct value on RPM-based systems. The change to a distutils package not provided by Fedora on Python 3.7 and 3.8 causes a regression in distutils.sysconfig.get_python_lib() that ultimately causes false positives to be emitted by pylint, because it can no longer find the system source libraries. Many Python tools are fairly aggressive about updating setuptools packages, and so even though this package is a fair bit newer than Python 3.7/3.8, it's not entirely unreasonable for a given user to have such a modern package with a fairly old Python interpreter. Updates to Python 3.7 and Python 3.8 are being produced for Fedora which will fix the problem on up-to-date systems. Until then, we can force the loading of platform-provided distutils when running the pylint test. This is the least-invasive yet most comprehensive fix. References: pypa/setuptools#2896 pylint-dev/pylint#5704 pypa/distutils#110 Signed-off-by: John Snow <[email protected]> Message-id: [email protected] Signed-off-by: John Snow <[email protected]>
Setuptools v60 and later include a bundled version of distutils, a deprecated standard library scheduled for removal in future versions of Python. Setuptools v60 is only possible to install for Python 3.7 and later. Python has a distutils.sysconfig.get_python_lib() function that returns '/usr/lib/pythonX.Y' on posix systems. RPM-based systems actually use '/usr/lib64/pythonX.Y' instead, so Fedora patches stdlib distutils for Python 3.7 and Python 3.8 to return the correct value. Python 3.9 and later introduce a sys.platlibdir property, which returns the correct value on RPM-based systems. The change to a distutils package not provided by Fedora on Python 3.7 and 3.8 causes a regression in distutils.sysconfig.get_python_lib() that ultimately causes false positives to be emitted by pylint, because it can no longer find the system source libraries. Many Python tools are fairly aggressive about updating setuptools packages, and so even though this package is a fair bit newer than Python 3.7/3.8, it's not entirely unreasonable for a given user to have such a modern package with a fairly old Python interpreter. Updates to Python 3.7 and Python 3.8 are being produced for Fedora which will fix the problem on up-to-date systems. Until then, we can force the loading of platform-provided distutils when running the pylint test. This is the least-invasive yet most comprehensive fix. References: pypa/setuptools#2896 pylint-dev/pylint#5704 pypa/distutils#110 Signed-off-by: John Snow <[email protected]> Message-id: [email protected] Signed-off-by: John Snow <[email protected]>
I didn't want to open a new issue for this, but I think there's a problem related to the override file.
This works in all the normal use cases. However, there seems to be a problem with virtualenv not copying that file: Is this a bug in virtualenv? |
I've filed pypa/virtualenv#2313 for this. |
The problem here may be that there's no strategic design for how _distutils_system_mod is meant to work. I'd be disinclined to recommend that tools like virtualenv and pip need to start honoring this file specially. On the other hand, since these tools previously would copy patched copies of The long-term solution here is going to be to remove distutils' own reliance on |
setuptools uses its own copy of distutils which breaks the build in a chroot if setuptools >= 65.6.1 (65.6.0 seems to work). Setting SETUPTOOLS_USE_DISTUTILS=stdlib solves the problem for now Ref: [1] pypa/setuptools#2896 [2] https://setuptools.pypa.io/en/latest/history.html#v60-0-0
With the closure of https://github.com/pypa/distutils/milestone/1, Setuptools now should be able to re-enable its local distutils as the default.
Before releasing this change, I'd like for platform reps to test the behavior of Setuptools>=59.2 with SETUPTOOLS_USE_DISTUTILS=local to ensure that the workarounds (reliance on sysconfig schemes,
_distutils_system_mod
) added in distutils are adequate.I'll give these platforms 30 days (Dec 18) to evaluate the behavior and identify any blockers.
/cc: @hugovk, @mattip, @FFY00
Please feel free to unsubscribe or tag in others.