-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Python3: Impossible to update pip any time a pip update is released #59802
Comments
not an official solution, just a workaround modify to
the issue is likely caused by |
@jnozsc Could we include this code in the formula? So that the problem is solved for everyone instead of just me |
I was struggling with this and thought it was just me. Installing the updates to For now at least notate the python page that updating |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I agree that the issue is stale. However, it's also still present… |
Still stuck with it... |
Did this actually solve the issue for you? |
Not really, I don't know how to use it. |
@gatto In that case please don't give me a thumbs down. LOL |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
FYI: pip 20.3 has been released, and Homebrew users are going to hit this again. |
homebrew-core/Formula/[email protected] Line 235 in aaee906
This is happening since Homebrew is using |
@pradyunsg so what would the solution be to prevent this issue? What's the alternative to using |
Using get-pip.py (use the tags on the GitHub repo to get exact versions: https://github.com/pypa/get-pip/), which would do the script-generation properly. |
Just tried playing around with this a bit today. One concern that I have is that we have no way to build One option (maybe not the best) is to get some kind of portable Python installation or venv to bootstrap this build (with the binary/wheels of |
I found that only |
FWIW, modern CPython also ships with ensurepip. |
pip has broken multiple times in the last few weeks for me due to the python-formula-generated How hard will it be for someone with the requisite knowledge to rewrite the install script to solve this issue by using I don't know Python, its install routines, homebrew internals, or Ruby, so it would be inefficient for me to create a PR myself. |
And this is exactly why we don't have a fix yet. As far as I'm aware no person exists that matches all these criteria. |
To be fair I think the required level of understanding of Homebrew internals and Ruby is quite low. The real barrier is someone who knows the details of installing Python and has the time to put into this. (I'm assuming the way that Homebrew installs Python isn't so idiosyncratic as to not be too difficult to understand for said person.) |
Can people who have some of the requisite knowledge & who have free time post what they know, and what they'd need help with? Maybe we can cobble together all the expertise necessary from a few people working together. If people can fill in gaps in each other's knowledge, the problem can be tackled faster than one person having to investigate by themselves everything that they don't know. |
Wait, why would you want to run with --no-binary? You're disabling the use of wheel files, which are basically zip files containing only the source code and no compiled artifacts. |
Perhaps I am misunderstanding what wheels are, but my understanding is that wheels are compiled artifacts (hence why on PyPi when you download a package, there may be many different wheel files - for different Python version/OS combinations), and that specifying Please correct me if I'm wrong. |
Why is Would removing that, and removing the usage of Or must |
Wheels are zip files containing the final files that go into the site-packages (which is on Python's import path, so These files can be compiled artifacts, but when the compatibility tag is "none-any", it's a pure-Python wheel -- only
🤷 FWIW, this feels like a consequence of deciding that "wheels are opaque compiled artifacts" and deciding to not use them. I'd strongly suggest avoiding this as well. |
@pradyunsg Thanks for the info. Under normal circumstances, would removing the use of If so, then all we need to do is find out why Homebrew doesn't do that, find workarounds for whatever issues are noted, then rip out & replace the existing odd install options / procedure. |
The PR says that ensurepip installs an old version of pip. Why would ensurepip install an old version of pip? Is there any way of forcing ensurepip to install the latest version, or an explicitly specified version that can be manually updated in the formula on every pip upgrade? In any of the cases, does ensurepip hard-code any package versions like the current formula does for pip? If so, then using ensurepip won't solve this problem, unless it somehow ensures that future updates to any packages whose version get hard-coded automatically update the hard-coded versions (which I doubt would occur, but, hey, it's theoretically possible…). Are there any other reasons why ensurepip isn't used? Who is the person currently in charge of the python formulae? Can they be roped into this discussion for guidance? |
Thanks for the information, that does help clear things up a bit. Homebrew has a penchant for preferring to work from source distributions (no compiled artifacts), so we have been using The fact that
Homebrew differs from most other package managers out there in that there is no particular maintainer responsible for a particular formula (working off of a back-of-the-napkin calculation, with ~5382 formulae at the time of writing and 26 maintainers currently, we'd each have to manage over 200 formulae, which is not sustainable). That's why we rely so heavily on community contributions, especially from people that actually know what they're doing and what they're talking about, because frankly, most of us Homebrew maintainers don't know all the ins and outs of Python distribution. This community-driven model is beneficial in that pretty much anyone can get involved, but at times like this, we can also see how things come to an impasse of sorts. As such, even though this issue is still ongoing, I'd like to take a moment to thank both of you for your input so far, @pradyunsg and @rgoldberg, for providing feedback, answering questions, and proposing some solutions to explore as well. ✨ |
@alebcay Thanks for the info and for the thanks. I wish I knew more about the associated technologies so I could provide answers instead of asking questions. If anyone knows anyone who might have answers, please mention them in this issue so we can canvass their input. Thanks everyone for your input. |
Because ensure-pip is provided by the python source files: it installs the pip version that is hard coded at the moment of delivery of a new Python version. So pip will continue to evolve and drift away from that version. But I guess we could do a pip update during the build to get the latest version? It does not look really deterministic though as we might pick up any random latest pip version. On the other side, when reading this, I am unsure get-pip.py is a good solution either: pypa/get-pip#60 |
It looks like you can upgrade pip packages to specific versions using the following syntax: pip install --upgrade $(package)==$(version) So the formula can update specified packages to specified versions. As long as this generates scripts that don't hard-code package versions, and as long as there aren't any other problems, it looks like we can solve this issue by:
We wouldn't need to use Does anyone see problems with this approach? There could be many, as I don't know any of the involved technologies… Would the normal Python install still include easy install, or would / should it be omitted if the formula no longer uses it? |
I can't repro this and I'm not sure how people are hitting it. I don't see a plausible root cause.
We aren't -- invoking setup.py isn't the same as using easy_install. This is just an installation from sdist. pip does this in the absence of a wheel. The presenting complaint sounds like an instance of a |
Although, on reflection, this would downgrade pip, so this probably isn't what people are looking for :) I'm curious whether |
It will, yea. The issue here is that the |
Oh, sorry Pradyun, I shouldn't be lecturing you on packaging. Why isn't pip rewriting this file when pip upgrades pip? |
Honestly, I don't know much about about easy_install's behavior beyond that it shouldn't be used because it's horrible in more ways than one, and I have no interest in learning about how. I don't really care about the nuances here -- don't use easy_install is an easier user-facing message anyway. 🤷🏽
Sure -- I'm unsubscribing from this issue right now, because I don't want to keep repeating myself here. My final notes here are: I think it'd be better if Brew's Python formulae stop going out of the way to disable all the supported mechanisms for distributing pip and intentionally use a mechanism for install that's (a) deprecated and (b) known to cause issues now. The supported installation methods are listed on https://pip.pypa.io/en/stable/installing/ -- pick one from there and use that please. |
To be clear, this isn't because I don't think this isn't a problem worth fixing (it is, and even I have hit it in the past) or because of something that someone else has said here/elsewhere or whatever. Rather, this is a matter of me prioritizing my time since I think everything that I had to say here has been said. Feel free to @ mention me if someone wants me to review the PR that fixes this, and I'll be more than happy to provide inputs on that. :) |
Thanks for your help and patience, Pradyun. I'll drop off of this ticket too -- I'm retired from Homebrew :) and I don't think humans should use these packages; you should use pyenv instead -- but I think a useful thing that Homebrew could do here would be:
I think we didn't do this originally just because it felt redundant. It is :) but it's not expensive. Reevaluating Homebrew's general approach in the light of continued progress in the Python packaging ecosystem could make sense. Using pip to install sdists instead of invoking setup.py directly could be productive. |
#67030 has been merged just now, which should fix the Some other ideas for bringing the Homebrew installation process of Python more in line with modern best practices were also spurred over the course of this discussion, but considering the length and scope of this issue, it may be better to discuss other improvements/problems in new issues/PRs. |
Possibly similar to #57612, Homebrew/legacy-homebrew#26900, https://discourse.brew.sh/t/homebrews-pip3-shortcut-via-pip-has-hard-coded-version-dependency-causing-errors/4912.
brew update
and can still reproduce the problem?brew doctor
, fixed all issues and can still reproduce the problem?brew gist-logs <formula>
(where<formula>
is the name of the formula that failed) and included the output link? (sorry, I don't know how this works)What you were trying to do (and why)
I was trying, in my fully upgraded brew python installation, to upgrade pip from 20.1.1 which is installed with python, to the newest 20.2.2 which includes some important changes.
What happened (include command output)
Pip crashes and won't ever work again unless I reinstall the formula.
Command output
What you expected to happen
Pip not to crash.
Step-by-step reproduction instructions (by running
brew install
commands)brew install python3
pip3 list --outdated
pip3 install -U pip
pip3 list
The text was updated successfully, but these errors were encountered: