-
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
Stop relying on __file__
#11648
Comments
As a broad principle, this is entirely reasonable, and it would be great if we could do this. However, it's not particularly easy to achieve that goal.
Being able to compile pip using something like PyOxidizer would be a nice feature. A standalone exe would be a potentially superior alternative to the recently added zipapp distribution. So if someone such as yourself was interested in working on this issue (and by implication, any other issues with compiling pip with PyOxidizer) that would be great. It's not high on the maintainers' priority list, though, so it's unlikely that this will happen without someone from the community leading the effort. |
I just installed
It seems to me that somehow you've installed Pip incorrectly? Does And what other option do you expect Pip to use? I'm not a Pip develop but it seems to me that Pip is deeply coupled to there being a filesystem and it needs to know the file path of code in lots of places? I did a quick search for CPython itself only expect |
I'm ambivalent on this and, at least, Paul is in favour of this. I've labelled this to say that we're open to accepting PRs toward this. I do have a couple of concerns / caveats around this:
|
To be more explicit, I'm only in favour if someone can solve all the issues in doing this. And I'm not at all convinced that those issues are actually solveable... In particular, I agree regarding dependencies. And I'd go further still - we need a solution that means that we don't have to go through this whole process again before adding any new dependencies. So sorting out our current dependencies is only part of the issue. Also, I agree that asking dependencies to stop using TBH, I'm not convinced by the arguments in the linked PyOxidizer issue. The docs say that (Someone still needs to go through existing uses of |
As a comment of sheer curiosity, I wonder how the popularity of (Interestingly the |
🤷 It's the same issue. But it's worth noting that pip is available as a zipapp, and our remaining uses of |
Based on https://pyoxidizer.readthedocs.io/en/stable/oxidized_importer_behavior_and_compliance.html#no-file and https://pyoxidizer.readthedocs.io/en/stable/oxidized_importer_resource_files.html#support-for-file which seems to take a more measured description of the problem and aren't a blanket "don't do That said, I don't want to let this issue linger forever, so if we don't end up getting any sort of contributions on this in the next six months, I'll close this out. As far as I can tell, there's not much that we can do unilaterally on this and we know that pip is directly usable as a zipapp. |
poke @pradyunsg - you may have forgotten about this :) |
Description
As indygreg/PyOxidizer#69 explains,
__file__
is optional, and in environments runningpip
where the interpreter doesn't define it: 💥An easy way to see this in action is
pyoxy run-python -- -m pip --version
(releases are here: https://gregoryszorc.com/docs/pyoxy/main/)
Expected behavior
No response
pip version
(
main
)Python version
PyOxy 0.2.0
OS
Ubuntu 20
How to Reproduce
__file__
. PyOxy is one of them: https://gregoryszorc.com/docs/pyoxy/main/pip
with that interpreterOutput
Code of Conduct
The text was updated successfully, but these errors were encountered: