-
-
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
[BUG] Having setuptools installed causes cpython stdlib build to fail #3007
Comments
I'm not sure what should happen here. Setuptools could potentially add another exclusion to the hack if there's a reliable signal to detect building CPython. Or maybe users should simply not add Setuptools to the site packages while building CPython. What's the motivation for having Setuptools present at this stage? |
There's no particular reason to want to be in this situation, it just happens sometimes when building python, usually a new version, after already having installed python and setuptools. If the issue can be worked around in setuptools without too much effort, great; otherwise I guess it's sufficient to just document it somewhere. Presumably it will eventually go away when distutils is dropped from the stdlib. |
I took a look at the traceback above, but by the time It's possible there is other context in the environment if for example, the Makefile sets some environment variable like PYTHON_IS_BUILDING. Setuptools could honor that. I scanned through the makefile and didn't find anything that looked relevant. In which case, "document it somewhere" seems like a good approach, and from my perspective, this report provides that documentation (anyone searching for that error message will find this bug). If you can imagine another place where documentation would be more visible, we could consider that. In the meantime, I'll close this issue, and thanks for raising it. |
@tiran had this to contribute:
|
Any kind of workaround of CPython's setup.py will only land in future releases of CPython 3.9 and newer. Python 3.6 and earlier won't get any new releases because they are EOL. 3.7 and 3.8 are in security-only mode. |
https://bugs.python.org/issue46401 is another case of the same issue. |
Work around pypa/setuptools#3007 Signed-off-by: William Douglas <william.douglas@intel.com>
Is it possible that the bug is back in setuptools 60.9.3? Please have a look at this Python regression: https://bugs.python.org/issue47013 |
In that issue, CPython is attempting to update from Setuptools 58.x. Setuptools 60 introduced the drastic shift to supplying distutils by default. So it’s probably safe to say that the approach applied above didn’t have the intended effect. Setuptools detects the presence of ./pybuilddir.txt to disable the distutils replacement. The “installed” tests probably don’t have this characteristic. In those environments, my recommendation is to set SETUPTOOLS_USE_DISTUTILS=stdlib when running tests. |
|
I ran into this behavior recently while trying to build Python 3.10.4 on Ubuntu 22.04, which resulted in a confusing error, This issue was closed, having been fixed by #3031. I'm a bit confused as to whether the issue is actually fixed or not, though. |
The issue reported here was addressed (stdlib builds do work for the most part). It appears, however, that there are some select cases where the CPython build detection isn't taking effect, so continues to lead to trouble. Let's continue the conversation in python/cpython#91169, which is the open issue describing the defect. |
setuptools version
setuptools>=60
Python version
Python 3.9.9 (and probably others)
OS
Probably affects all; reported on macOS
Additional environment information
Originally reported in the context of MacPorts' python39 and py39-setuptools ports.
Description
If you have setuptools installed and attempt to build cpython from source, setuptools' copy of distutils may be used when building the stdlib modules and cause the build to fail due to an incompatibility.
This is easily cured by setting
SETUPTOOLS_USE_DISTUTILS=stdlib
if you understand the problem, but if you don't, it's a pretty baffling failure mode.Downstream report: https://trac.macports.org/ticket/64352
Expected behavior
Cpython build uses its own distutils and succeeds.
How to Reproduce
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: