-
-
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] Importing pip breaks setuptools #3297
Comments
Hi @dwpaley, thanks for bringing this topic for discussion. Some versions of pip curently don't seem to handle well situations when At the same time, As a result, Unfortunately I don't think we can manage to combine usage of
Or do you have a suggestion on how to implement a workaround? (If you do, please feel free to open a PR! We would be super happy to have a look). |
It might also be the case this problem is not observed for Python >= 3.10 |
@abravalheri Thank you! I also observed this behavior (at least "bug 1") on Python 3.10. In any case we'll need to support older Python versions for a while. Thanks for the |
Would you be open to a PR that adds warnings for incompatible combinations of imports? (maybe warn if importing pip after setuptools, and refuse more explicitly to import setuptools after pip?) |
Hi @dwpaley, sorry for the delay. Yes, that would be great. All PRs are welcome! Thank you very much. (I am a bit curious though on how to do that without showing warnings during regular/standard pip operations...) |
For the record (and to link the two issues), I added a "workaround" to this issue in #3439 (comment). I didn't validate that the resulting |
i was building a wheel file with the "manylinux2014_x86_64 that was recently build in 2023-08 and i ran across errors whenever i did (sanity check looking for pip,setuptools,wheel):
the issue is specific to python version >= 3.7 the fix i did was:
|
python version >= 3.7 and setuptools version >= 60 Info: userwarning: setuptools is replacing distutils Link: pypa/setuptools#3297
python version >= 3.7 and setuptools version >= 60 Info: userwarning: setuptools is replacing distutils Link: pypa/setuptools#3297
setuptools version
setuptools>=60
Python version
tested on python 3.8 and 3.10
OS
tested on MacOS 10.15.7 and CentOS 7.4
Additional environment information
No response
Description
setuptools
, then importpip
, then callsetuptools.setup
, then I get a crash with'distutils'
missing fromsys.modules
.pip
, then importsetuptools
, I get an immediate crash onassert '_distutils' in core.__file__
A few connected issues are:
Expected behavior
Wish I could still use
setuptools
after importingpip
How to Reproduce
First bug:
toml
filerepro.py
that importssetuptools
, then importspip
, then callssetuptools.setup
build
The first bug is not triggered if any of these changes are made:
setuptools=59
repro.py
tosetup.py
Second bug:
Output
First bug:
Second bug:
The text was updated successfully, but these errors were encountered: