-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Error with import pip
in pip 9.0.2
#5081
Comments
I can confirm this as well. Just about to file same issue. |
This is a dupe of #5079 -- importing pip is not a supported use case (and never has been). |
Come on.. making a huge breaking change in a single |
This also broke Anaconda and I came up with the same solution as @Miserlou: ContinuumIO/anaconda-issues#8911 Errors are being reported across a lot of projects. |
This error also bothered me when I was trying to use pip to update my anaconda-navigator. |
Is there any chance of us getting a 9.0.3 that fixes this - ideally quite soon? This is already affecting lots of major projects (Anaconda, SpaCy, Zappa), and there are more than 850k+ uses of this on GitHub alone that are now broken by this supposed "patch" version update. Can you at least revert this massive change in 9.0.3 and then announce to downstreams your intention to change this behavior for a future 10.x.x or at least 9.x.x release? |
We don't want to use an older version either, but that's exactly what we ended up doing. 9.0.2 does not exist inside our CI environment, at least for now. |
Also seeing this hit in some OpenStack projects. |
Pip 10 is due out in about a month. As I understand it, the issue is with code that uses If @dstufft wants to make an emergency 9.0.3 release, I'm fine with that. But it will only be a very short term benefit, and I'm a little disappointed that people haven't already moved away from Proposals for reintroducing some level of API support are certainly an option (see #5080 for example) but at this stage, it's too late for any such changes to make it into pip 10. |
With no warnings being raised by the code for those using the old way, nothing denoting this as "internal" with starting with _, and this just being a bugfix bump, I actually think it's quite easy to see this as a sudden, unexpected breakage. |
Yes, this is the type of change that people could expect from a Unfortunately, this massive change came in a You should revert this change ASAP in another I also think it's a cop out to say that this was documented and announced already, considering that it was not documented in the stable documentation, and that the announcement said that the break would happen for the major version, not for in a patch a month prior. Please, just save everybody a massive headache, revert this problem and start actually adhering to semantic versioning. |
@Miserlou OK, I take your point - we targeted the internal renaming change for pip 10 because it's a major version. I don't really know the drivers for the patch release - @dstufft pinged me about it and it's apparently to avoid significant breakage for Mac OS users when an imminent deadline for TLS support hits us, which is before the pip 10 release. We expected the problems to be significant enough to warrant a short-term patch release. There was certainly no intention of breaking existing usage. I have to leave the decision of a follow-up 9.0.3 to @dstufft - I don't have the details of what went into 9.0.2 or know whether it's even possible to identify how to fix this issue. And I can't judge whether pulling 9.0.2 altogether will be an overall benefit, as I have no idea how many people are affected by the Mac OS issue. I understand that (at least for some people) pinning to 9.0.1 is a solution, so that may end up being the least bad option. |
The macOS TLS issue will affect everyone using a system Python on macOS<10.13 |
Workaround, if you have it available to you, is to check the order of imports and test moving importing pip above other package imports (specifically, importing pip before importing requests seems to solve some cases). (Note that this still implies use of pip's internals, which isn't officially supported.) |
Same issue here with pip 9.0.2 in a gitlab-ci with docker python 3.4: KeyError
|
FYI, 9.0.2 was released with broken builts: Travis-CI Reference: https://travis-ci.org/pypa/pip/builds/354616774?utm_source=github_status&utm_medium=notification Granted the errors might be unrelated, though this just smells like a "rushed release"... |
I can not believe that this is a statement by the owner of this repository... You literally just said "f*ck semantic versioning" and "who needs a deprecation policy anyway". |
pip always was documented as NOT having a consumable python api, i'm disappointed in people that even at that point try to turn around the "told you so since quite some years" karma |
This is necessary to fix breakage when upgrading to pip 9.0.2. See: pypa/pip#5081
Thanks for the fast resolution, from someone who never wrote I second/third/Nth a proper deprecation warning being added to make things smoother. maybe even a pypi.python.org post? |
Hooray! Thanks for this! I'd also really love a deprecation warning, and, more importantly - proper instruction on how to programmatically inspect python environments in a pip10 world! Clearly there is a need for that, given that over 700,000 applications were affected by this bug. |
|
Firstly thank you all contributing to pip people for it totally covers all of my use cases with a few user-friendly options and arguments. Due to this "surprisingly widely adopted and useful undefined behavior," do we need to make a piplib as libgit2 for git? Please note that libgit2 is not sharing any code with git, and is maintained by other group from git's. And it is good for git ecosystem. Maybe piplib will cover some interesting use cases which we didn't expect. Here is a similar story: https://public-inbox.org/git/1267957655.3759.29.camel@mattotaupa/T/ |
@drunkwcodes I suspect that what you propose is already implemented in the existing packages that the pip documentation mentions, It seems to me that such tools could work around this problem by wrapping import statements in a try/except block, but that also seems like a questionable precedent to set. Given the release of pip 9.0.3, though, I think it's probably not worth the time to debate the import issue unless the problem happens again in pip 10. Anyway, as long as the maintainers don't go out of their way to make |
@sruggier The packages metioned are all good, and WheelFile.install() also needs more promotion. But the one-stop service The most important is that I hope these needs are held by another project, and pip10 will arrive smoothly without extra guarantees. The deprecation and minimizing the code base are the whole points for a major release. Concrete implementation details for a permanent infrastructure "software" is ridiculous. You can't judge maintainers by the documented abuse case and hold back the wheel of pip. If you insist to use pip as a lib, a lot of assumptions will need to be reconsidered. |
@drunkwcodes Just to be clear, Also, the reason |
I appreciate the work you all do on pip, and know it's not easy. But for the record:
spaCy has moved away from |
What is PyPA's position on distlib? Pip is obviously using it in some capacity, but so too is it using packaging, which distlib purports to deprecate. If there isn't an official position, then at least current thoughts and opinions from pip's core maintainers would be much appreciated. If there are relevant discussions on this topic elsewhere, a simple pointer to other discussions is good enough for me. |
I'm not aware that distlib deprecates packaging. It mentions "distutils2/packaging" but distutils2 was something different. My personal view is that both distlib and packaging are perfectly reasonable things to use. You should evaluate them yourself to confirm they meet your needs, obviously, just like any other dependency you rely on. |
Maybe deprecates is too strong of word then. The source of my current understanding: https://distlib.readthedocs.io/en/latest/overview.html#distlib-evolved-out-of-packaging |
Ah, that's a different "packaging" - it was the proposed stdlib module that was intended to replace distutils. It's completely different from the PyPI |
Already done that :) See: https://bitbucket.org/pypa/distlib/issues/100/clarify-project-positioning-and-status |
Previously, we used internal pip code, which was changing in point releases, causing issues. We actually don't need pip to do this, we can instead ask the installed python's pkg_resources directly for the same info. Related issues: pypa/pip#5079 pypa/pip#5080 pypa/pip#5081
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Some users are now experiencing an import error when calling
import pip
in a function with pip 9.0.2. Downgrading to 9.0.1 fixes the issue.Trace: https://user-images.githubusercontent.com/2273226/37558391-5e41fc94-2a24-11e8-9fdc-5884445e829a.png
More details here:
Miserlou/Zappa#1446
The text was updated successfully, but these errors were encountered: