-
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
Install with --no-binary ignores PEP 517 build system #6222
Comments
From pypa/flit#245 |
See this comment #6163 (comment) and this thread for a related discussion: https://discuss.python.org/t/pep-517-backend-bootstrapping/789 |
I think this is separate from the bootstrapping issue (which I don't think currently affects Flit), but I suspect @pfmoore's comment that " The problem appears to be that pip isn't even trying to use the PEP 517 backend, because it interprets the |
I'll change this to "needs triage" for now because PEP 517 isn't my bailiwick. (I don't know if this is a case of "hasn't been implemented yet" or if something hasn't been implemented correctly. Either way it should probably be failing more gracefully.) |
Yes, if that is what's happening, it's unintended. |
Quick check of the code, it looks like this is the problem.
I don't know how to fix this, and I don't want to go for an obvious "quick fix" approach. My instinct is that it's insane to ever have an instance of a wheel cache class that can't return wheels - so I can only presume that my understanding of this code is incomplete. I don't know who wrote that code but if anyone who understands it (@pradyunsg?) can explain the intention and/or suggest a fix, that would be great. I'll try to find some time to investigate in more detail, but I really don't have much free time at the moment. |
The use cases I'm aware of for From your description, I suspect it's a historical accident. The cache machinery is designed for a persistent cache, which may already hold wheels you don't want to use at the moment. I derived the 'ephemeral cache' fairly recently, to hold wheels built, used and discarded in one run of pip. |
Looks like I was entirely wrong, because the original motivation was:
Given that PEP 517 projects can only be installed by building a wheel, maybe we have to say that the flag means different things for a project built by a PEP 517 backend and a |
Actually, that looks to be precisely the use case they were targeting when
|
Yep, that looks pretty much like a direct conflict between PEP 517 and The big question then is whether we desupport projects that cannot be installed via wheel. IMO, we probably should (or we'll never be able to make significant progress towards reliable static metadata among other things) but we'll need to handle that desupport carefully (recent deprecations like dependency-links haven't been handled ideally and we need to be seen to be improving in that regard if we want to keep credibility). I've created this thread for further discussion. |
It's more like, "hey, this package should not be going through a wheel so the cache won't expose those". It's just another case of intertwined responsibilities in the codebase. Ideally, Cache won't contain FormatControl instances but I didn't have the time to clean that up because something else with a higher priority had come up back then IIRC. |
@pradyunsg whoops, you took what I said a little out of context. I said "My instinct is that it's insane..." What I was getting at was precisely that it seems unlikely that it was done without a reason, but there's a reasonable probability that it's just mixed responsibilities and a bit of "good enough for now, tidy it up later", as you confirmed. Sorry if it sounded like I was criticising. The mistake was mine, in blindly using the cache without checking (my excuse for doing so was that the name looked like it did what I thought, so I didn't check further). But as Chris identified, the original intention actually was to prohibit "build from wheel", so we got to the motivating requirement, which was the main question. |
No no. I didn't take it as a criticism. 🙈 (yay miscommunication) You have nothing to be sorry for. The point I wanted to make was, I hadn't changed that behavior due to the initial functionality expectations (as @cjerdonek found from the tracker) -- the current behavior, post the refactor, is weird but in line with the initial motivation for introducing the functionality. I didn't bother elaborating upon/reiterating the original motivation for adding that, since it had already been figured out. :) None the less, I think I should have spent some more time making sure that my own tone wasn't so rough -- since I was basically just adding a neutral informational point, not reacting semi-defensively -- in that previous comment. |
Ha - one day we'll meet in person and realise that we never actually understood anything the other person was talking about :-) |
😆 Perhaps. |
Even when building with |
Yea, |
This is a workaround for pypa/pip#6222. It should not be a permanent change.
I think I found the issue. This issue seems to occur only if you try to install a package that has a dependency to a "PEP 517" package but not if you install a package that itself is "PEP 517". This led me to inspect the pip/src/pip/_internal/req/req_install.py Line 895 in a240a98
I guess there needs to be a statement that builds the wheel form source if pep517 is detected and then copies the wheel files over to the desired location similarly as we do when we install a requirement from a wheel. |
…ut setup.py The idea of this patch is that we build a wheel and install that whell when we install a requirement from source that does not support setup.py. Fixes pypa#6222.
So I submitted a PR #6606 for pip that solves the issue (at least for me). Now there should be some tests to make sure that my fix works properly and continues to do so in the future. Would anybody be willing to write those tests or at least help me with writing them? I am not familiar with testing in pip and quite frankly, I don't know much about the assumptions about the inner workings of pip. |
You can look at tests/integration and find a file with pep517 in it's name. You can use those tests as reference for writing new tests here. :) |
otherwise we will fail to install the build dependencies of `lazy-object-proxy` from the wheelhouse. as `lazy-object-proxy` does not add `setuptools_scm` in its `setup.py`, instead it lists `setuptools_scm` in `setup.cfg` and `pyproject.toml` as a `build-system` requires. but unfortunately, `pip download` only downloads the install/run-time dependencies at this moment. and `lazy-object-proxy` does not offer binary package for at least python2.7. ideally, `pip` should collects its dependencies like Collecting setuptools_scm>=3.3.1 (from lazy-object-proxy->astroid<3,>=2.2.0->pylint->-r requirements-lint.txt (line 1)) so we have to list its build-time dependencies explicitly. see also pypa/pip#6222 Signed-off-by: Kefu Chai <kchai@redhat.com>
otherwise we will fail to install the build dependencies of `lazy-object-proxy` from the wheelhouse. as `lazy-object-proxy` does not add `setuptools_scm` in its `setup.py`, instead it lists `setuptools_scm` in `setup.cfg` and `pyproject.toml` as a `build-system` requires. but unfortunately, `pip download` only downloads the install/run-time dependencies at this moment. and `lazy-object-proxy` does not offer binary package for at least python2.7. ideally, `pip download` should collects its dependencies like Collecting setuptools_scm>=3.3.1 (from lazy-object-proxy->astroid<3,>=2.2.0->pylint->-r requirements-lint.txt (line 1)) so we need to use `pip wheel` do download build-time dependencies see also pypa/pip#6222 Signed-off-by: Kefu Chai <kchai@redhat.com>
otherwise we will fail to install the build dependencies of `lazy-object-proxy` from the wheelhouse. as `lazy-object-proxy` does not add `setuptools_scm` in its `setup.py`, instead it lists `setuptools_scm` in `setup.cfg` and `pyproject.toml` as a `build-system` requires. but unfortunately, `pip download` only downloads the install/run-time dependencies at this moment. and `lazy-object-proxy` does not offer binary package for at least python2.7. ideally, `pip download` should collects its dependencies like Collecting setuptools_scm>=3.3.1 (from lazy-object-proxy->astroid<3,>=2.2.0->pylint->-r requirements-lint.txt (line 1)) so we need to use `pip wheel` do download build-time dependencies see also pypa/pip#6222 Signed-off-by: Kefu Chai <kchai@redhat.com>
otherwise we will fail to install the build dependencies of `lazy-object-proxy` from the wheelhouse. as `lazy-object-proxy` does not add `setuptools_scm` in its `setup.py`, instead it lists `setuptools_scm` in `setup.cfg` and `pyproject.toml` as a `build-system` requires. but unfortunately, `pip download` only downloads the install/run-time dependencies at this moment. and `lazy-object-proxy` does not offer binary package for at least python2.7. ideally, `pip download` should collects its dependencies like Collecting setuptools_scm>=3.3.1 (from lazy-object-proxy->astroid<3,>=2.2.0->pylint->-r requirements-lint.txt (line 1)) so we need to use `pip wheel` do download build-time dependencies see also pypa/pip#6222 Signed-off-by: Kefu Chai <kchai@redhat.com>
otherwise we will fail to install the build dependencies of `lazy-object-proxy` from the wheelhouse. as `lazy-object-proxy` does not add `setuptools_scm` in its `setup.py`, instead it lists `setuptools_scm` in `setup.cfg` and `pyproject.toml` as a `build-system` requires. but unfortunately, `pip download` only downloads the install/run-time dependencies at this moment. and `lazy-object-proxy` does not offer binary package for at least python2.7. ideally, `pip download` should collects its dependencies like Collecting setuptools_scm>=3.3.1 (from lazy-object-proxy->astroid<3,>=2.2.0->pylint->-r requirements-lint.txt (line 1)) so we need to use `pip wheel` do download build-time dependencies see also pypa/pip#6222 Signed-off-by: Kefu Chai <kchai@redhat.com>
Shout-out to @seppeljordan for actually fixing this! ^.^ |
Environment
Description
In a clean environment, run:
The output includes this:
Pip 19 is aware of PEP 517, and uses it if you do
pip wheel --no-binary :all: flit
(the output includesBuilding wheel for flit (PEP 517) ... done
). But when installing from an sdist, it seems to default to runningsetup.py install
instead of building a wheel using the PEP 517 backend and installing that.This is a problem in practice because pip does respect the PEP 518 build dependencies and create an isolated build environment, without setuptools. Setuptools is not required to build with the PEP 517 backend, but it is if you use the fallback
setup.py
script.It appears that the no-binary option disables the 'build a wheel and install that' pathway. But I think that option is generally taken to mean 'download the sdist rather than the published wheel'. The plan is for all PEP 517 installations to work by building a wheel and then installing that.
The text was updated successfully, but these errors were encountered: