-
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
Raise a warning when pip falls back to the "legacy" direct install code #8102
Comments
The answer may be obvious, but I’ve often wondered: As far as I understand, quite a few libraries are already vendored with pip, why isn’t wheel simply one of them? |
Basically, because pip doesn't itself use |
+1 for this. Do we want to start the deprecation process now (and collect feedback in a deprecation issue), or simply raise awareness with louder messages? We could raise the level from info to warning in pip/src/pip/_internal/wheel_builder.py Lines 72 to 78 in 814c54f
pip will also fallback to legacy install when wheel building failed for other reasons, so we may want to warn there also, and encourage people to make sure that pip/src/pip/_internal/commands/install.py Lines 368 to 370 in 814c54f
|
I'm on board for this, though we'd need to decide on how long this should be. |
+1 from me. Part of me wants to say 21.0, to match the Python 2 desupport, because that makes it a single breakpoint for users (the "desupport everything" release 🙂). The converse argument is that users won't want to have to deal with 2 different issues in the same timeframe, but my instinct is that the affected groups of users are likely pretty disjoint (and/or the same solution, pin or upgrade your project, fixes both issues at the same time). |
I'm glad I didn't say this first. :) I'll flag that the sheer amount of traffic on PEP 517 and projects that can't install via wheels (~46k views, most viewed) tells me that there are lots of users who use the direct "setup.py install" code path. The next topic in terms of number of views is something that, IIRC, made it to the front page of Hackernews, had to be closed by moderators, and THAT has just about half the number of views: https://discuss.python.org/top/all. Thinking about this more, I'm uncomfortable suggesting "let's warn/deprecate now" without us spending some time checking if we can do something better in overall "PEP 517/PEP 518/build isolation" situation, which is strongly coupled to this IMO. I really don't have a good feel for what is a reasonable approach/strategy for eventually transitioning off the legacy build/install logic would be, and it feels like we should talk about the broader problem first before discussing the specifics here. |
OTOH, our deprecation mechanism, combined with a friendly message, is a nice way to ask concerned users to report feedback in a GitHub issue. Based on that feedback we can still decide not to deprecate at the planned date or otherwise adjust the strategy. Also, in my understanding, deprecating the |
Wait - what I thought we were discussing the deprecation of was falling through to Forcing everything to use PEP 517/518/build isolation is a much bigger issue, and I agree that for that, we need to disentangle some of the complexities around isolation, |
Another reason to deprecate the |
I've long wished we had a way to get some metrics on pip usage, to try and suss out these kinds of questions. As it is right now, we really have no good way to determine if 100% of |
Agreed. So (possibly over-eager) deprecation is a blunt tool, but it's really the only way we have of judging impact. There's also in this instance the case of catching people who simply forgot to install wheel, and have absolutely no problem installing it if reminded. I do that all the time when I use venv. |
And you are correct. I just derailed and started mixing this with the other bigger problem in my head (we use "legacy" for way too many things now). :)
Indeed! It is a nice way, and I don't think we have any other option here TBH. :) |
We could also try to install those using build isolation and a default |
The down side to this would be more confusion. We already have people asking why pip fails to install setuptools even though I don’t think this precludes the possibility, to be clear, but we’ll need to consider the support cost trade-off 🙂 |
I agree with @uranusjr here. PEP 517 (and 518, and build isolation) has up to this point been an opt-in choice (at least in the sense that unless you change your project or your build command, pip won't change its behaviour. Erroring out sticks to that policy, telling the users how to opt in (or remain opted out for a little bit longer), but not opting them in silently. |
Fair points but I suspect we'll then also get users asking "why does pip complain that wheel is not installed and does not install it already ?" ^^ |
@xavfernandez I'm somewhat confused. The original proposal here was essentially "if we get through the build code paths, and end up at the point where we currently do Basically add a deprecation/error at this line in the code, ultimately removing the following lines and What you seem to be suggesting is that much earlier in the process, we check whether the user has wheel installed, and if not then we effectively set the I'm not against your proposal, but it's more than what I was proposing, and it seems like it would be a more controversial change (because my proposal is a strict subset of yours, if for no other reason 🙂). |
I think you're referring to #7709? |
Digging into this a little bit I remember that So this warning would also mean deprecating that behavior of |
For me this happened due to this: virtualenvs created with
but virtualenvs created by
I don't know the details, but I think many people create virtualenvs using |
So, after more head scratching than I care to admit, #11359, #11452 and #11454 finally conclude the series of deprecations towards removing @pypa/pip-committers do you think we should already announce a deprecation deadline (gone_in) in (some of) these, or should we wait for (more) user feedback? I tend to think the packaging landscape has matured quite a lot in the last year, but I may be underestimating the number of legacy projects that can't build a wheel for any reason. |
I'm inclined to say we should make the timetable explicit. We've been clear on our intention for some time now that we plan on removing |
We should, yes. I’m personally OK with picking a deadline anything from 6-12 months after 22.3. I’d lean toward 6 months… 6 months is the shortest we’re supposed to be doing, based on what we’ve agreed as a baseline for deprecations. |
Ok, I'll change the PRs to set gone_in 23.1. |
Done. The next question will be if we'll need a period where setup.py install is available behind a |
I don't have a good sense of how much churn this would cause for users. The intuition I have for adding |
My intuition says that we'll get people complaining, but they will be the sort of people who aren't looking for a transition mechanism, but rather for a "make it work again" flag. So they'll simply complain again when the So I'm fine with not adding a If during the deprecation period we get anyone raising a serious and genuinely intractable issue, we can review and if necessary extend the deprecation period. If they don't engage with us until it's too late, well, I guess it's too late 🤷 |
Agreed. I think users who may be most impacted are application authors who are (perhaps unknowingly) on the setup.py install code path and rely on (unmaintained) libraries which install successfully but don't support They might be using setup.py install simply because they created a virtual environment with |
Hmm... I wonder if we should extend the isolation enabling logic, from #10717 to include wheel -- i.e. use isolated pyproject.toml builds if the environment does not have both setuptools and wheel installed. That's one way to avoid falling back to |
Actually, here's a shower thought... It might make sense to entirely disable both This could render some packages unusable on Python 3.12+, but I reckon that would be acceptable -- if they are actively maintained, the maintainers should be able to update the build system to behave correctly on newer versions of Python. How do people feel about this, and do you reckon this is a good idea? |
@pradyunsg does that imply keeping support for setup.py install and setup.py develop until we drop support for Python 3.11? |
No. I'm thinking of it as putting a maximum limit of when it will definitely be dead -- when 3.11 support is dropped in ~5-6 years. We could still drop support for these mechanisms on older versions of Python before then, but it certainly won't be a problem after 6 years. |
In any case, we have currently merged |
Assuming that works out, this only applies to the setup.py develop case then. :) Let's move the discussion there. |
pip has deprecated (pypa/pip#8102) version names that do not comply with PEP440 (https://peps.python.org/pep-0440/). Making this change also avoids what seems to be a bug in newer versions of setuptools which can mangle the shebang (#!) when installing gradient_unwarp.py using the fallback option used by pip for non-compliant packages.
@sbidoul Would you have time/energy to file follow ups removing the relevant logic in this case? I’m down to do so, if you don’t have the bandwidth. |
Hi @pradyunsg, yes I'm happy to do it. I'm kind of planning to work on this around mid/end of March. |
Awesome! I'm looking forward to seeing this happen! ❤️ |
What's the problem this feature will solve?
The legacy code (which calls
setup.py install
directly) relies on setuptools to generate entry point wrappers. The wrappers setuptools generates require pkg_resources at runtime, and are reported as being very slow (see pypa/setuptools#510 (comment) and the discussion leading to it).Having pip warn in this case would be helpful in diagnosing the subtle behaviour change when wheel isn't present.
Describe the solution you'd like
When pip uses the
setup.py install
legacy code path, issue a warning pointing out that because the wheel library isn't present, pip is runningsetup.py install
directly, so old-style script wrappers will be generated.Alternative Solutions
The solution is to install wheel, but this is not obvious from the information pip currently provides.
Additional context
The warning has the potential to be "noisy", warning users when they don't care about the issue it's describing. But the legacy code path is just that - legacy - and ultimately we'd like to remove it. Warning people that they are inadvertently using a legacy code path prepares them for that possibility.
Conversely, the requirement for wheel to be installed is not well-managed currently (the stdlib
venv
doesn't install wheel by default, people don't typically realise that they should install wheel when just doingpip install .
, etc. The proposed warning will give the requirement more visibility, which might help trigger a more useful discussion on how to manage the requirement for wheel.Longer term the solution will be to switch fully to PEP 517 processing, but that is likely to be some time off yet.
The text was updated successfully, but these errors were encountered: