-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Circular imports in pip._vendor.requests #6498
Comments
How did you install
|
Ooooof ... so it looks like I had this "gem" in my import warnings
from pip._vendor.requests.packages.urllib3.exceptions import InsecurePlatformWarning
warnings.simplefilter('ignore', InsecurePlatformWarning) Still, how come that causes the import problem? |
It looks like the root of the problem is that a plain |
There's still some crappy code if importing something from vendor first makes everything fall apart imo. Sure, from an user's perspective it doesn't matter (no one should be doing that) but from an maintainer's perspective you gonna get bitten by that sooner or later. |
Anyway, feel free to close. |
You're not wrong - anything like this is likely unintentional and it will waste someone's time at some point, it would be more time-effective to have a test that checks all modules and can raise an explicit error saying which one has a circular import. In the worst case that there is something done intentionally, we should be doing it knowingly and have to add the module to a blacklist in the test. I think we can leave this open until such a test is implemented or someone has a good argument against it. |
FWIW, it's unlikely that we'd make drastic changes to our download code or to the import order, that'd surface this. I agree that this isn't good and fixing it would be ideal but, I do feel that this is fairly low priority though. Anyway, I'm not looking to block someone from looking into this; just stating my opinion on this situation. |
IIRC the circular import problem has existed for quite a while (at least in the 9.x series), and the workaround is to import something else before you import the vendored requests. I wasn’t very interested in submitting a patch back then since I figured there would be limited interests, but I can probably help if someone really wants to get this fixed. |
Closing since I couldn't reproduce this on master anymore. $ cd src/
$ python -c "import pip._vendor.requests; print(pip)"
<module 'pip' from '/Users/pradyunsg/Projects/pip/src/pip/__init__.py'> |
I had put this previously in #6498 (comment), and after trying to implement it my argument against this test would be that we would have to either:
|
Looks like since pip 18.1 there's a circular import problem. All versions including 18.1 and 19.1.1 produce something like this (traceback from 19.1.1 release):
Contents of the bin script:
Note that 18.0 doesn't have the problem.
This happens on Ubuntu 18.04 if it matters (yes, pip is installed globally, python-pip deb package not installed of course).
The text was updated successfully, but these errors were encountered: