-
-
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
setuptools 50 fails with KeyError: 'distutils'
when installing some packages
#2351
Comments
Could this be a side-effect of overriding distutils on stdlib the as described in #2350? I'll try to confirm the workaround (using EDIT: the workaround worked fine, as long as I run it before installing python via apt-get / get-pip installations . |
not likely, it rather seems that |
The doit issue is caused by an |
I'm not sure that it's |
FYI, The two supported values for |
Aha - so I have a hint of what's going on. In this method of the distutils hack, Setuptools aims to get out of the way, disabling the hack and falling back to stdlib imports of distutils when pip is running. pypa/pip#8761 is mentioned as the rational for this behavior. This method is assuming, as pip requires, that pip not be used as a library, but only be invoked through its command-line interface. The fact that you've imported setuptools, then imported pip, means you've violated this expectation and triggered the condition where although Perhaps the thing to do here is to raise an error in Alternately, the routine could avoid clearing distutils if setuptools is already imported. That approach would possibly fix the behavior, but only if the undesirable pip behavior that's being avoided isn't triggered following the user's import of pip. Should Setuptools support importing of pip after importing of setuptools? My instinct is no and to declare this failure as an unsupported use-case.
Can you make a strong case why |
I see, thanks for the explanation. Closing this issue as irrelevant then. |
Is |
And if it's not supported, should it simply fail (maybe with some environment detection) instead of asking why people uses an unsupported code later? |
According to using pip in your program, #2381 takes some steps to avoid breaking under the conditions where pip is imported.
Perhaps that's a question for the pip maintainers. My instinct is that users should be allowed to "import pip" at their own risk, so it shouldn't be strictly enforced. |
I got the following error when tried to install
doit
.The text was updated successfully, but these errors were encountered: