-
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
pip download with --no-binary flags for projects with alternative pep 517 build systems breaks under some circumstances #5739
Comments
pip needs to prepare each source requirement (run its But in this case, there's a circular dependencies in the build/install requirements chain: Note that this works fine if wheel installs are allowed at least for |
@benoit-pierre yay, that makes good sense to me; would you consider this working as intended then? I think you did the implementation of the requirement tracker which is a nice idea and a good step toward something I think everyone wants, but the element that was not intuitive to me was the specific cause of the issue (I probably could have guessed, but I just installed flit directly myself and moved on). I'm sure there are lots of reasons why Longer term the ideal case would be to not allow build systems to depend on packages that depend on them and thus avoid circular dependencies in the first place (this seems like a good case for vendoring in flit, but it also feels like enforcement might be possible here as well) |
IMHO it works as expected yes.
I guess the exception / error message could be tweaked.
That's going to be hard.
Yeah, any build system that have dependencies relying on it will be trouble...
How would you enforce it? |
It feels like we are back in
Obviously this can be done recursively and it can get pretty complex, but I'm not 100% sure that would cause a problem (I guess it probably would?) I'm not sure that situation (nested cyclic dependencies for build systems) is ever occurring currently but it may in the future. The simplest bet would just be to handle the exceptional cases.
For cases like mine where the user is specifying |
There's no way around it... Even with a proper source distribution, there's not enough metadata to determine dependencies. Not that it matters anyway, since pip support things like VCS installs. So it needs to run
The possibility of nested cyclic dependencies! That's exactly what is happening in this issue and what the requirement tracker is for.
How do you know the issue is with not allowing wheels? How do you know if wheels are even available? I find this kind of things (suggesting a "magic" command that will fix the situation) is a bad idea: not only is it impossible to find one that works in all cases, but the end results is invariably users blindly executing it (look at the mess with the "you should upgrade pip" message), so you're only moving the goal post further... |
Hah, ok. I guess I am persuaded, I didn't consider that wheels are built for VCS requirements as well now; we are working on a library to handle a lot of that during dependency resolution and I believe we simply raise a resolution error if we encounter cyclic dependencies (we built it on an acyclic graph) I don't really know how else this might come up or where the error needs to be raised, but once we have a better understanding of the scope of how this error might happen, from my POV an ideal message might be: I realize it's likely not quite that simple, given the variables, but anything that provides that kind of info would be super helpful That said this is likely low priority, I'm sure it's not that common |
I just came across this - FWIW, I plan to drop requests_download as a dependency from flit once pip supports PEP 517 enough that you can I've tried to make sure that all the other dependencies of flit use setup.py packaging, to avoid precisely this kind of circular dependency issue. |
This is a problem for Homebrew recipes of Python projects which use |
As of Flit 1.2.1, |
Same problem with tomlkit/poetry:
|
Should |
After further thinking on this I also realized that when I was having this error I was actually running pip in an environment where the build-time dependencies were already installed. Why would pip need to re-download and re-manage the dependencies of poetry, for built-time-only use, when they're already installed in the same environment pip is being run from? The more I think about this the more it makes sense that pip should be able to use already-installed packages when it comes to build-time requirements. |
There's a distinction here between reusing build dependencies that are already built and those that are already installed. Reusing dependencies that are already installed means building in an existing environment, which is what we're trying to get away from. But if the dependencies are already cached as wheels locally, setting up a new environment with them should be fast - it doesn't need to download or build them again. |
I can understand that but there is an inherent flaw, as evidenced by this ticket. If It seems like there needs to be some way of relaxing the Perhaps |
I'm trying to better understand the cause of the issue, and what a resolution might be for pip/its users. Is the idea that the current implementation means build systems shouldn't have external dependancies that are un-vendored? I think that relying on dependancies to use a different build system than those that depend on them would be a bit of a nightmare in terms of management of dependancies further into the tree. I'm not involved in the core python area but if that is the direction we're going, should that be part of the PEP for alternative build systems? I assume there is a close relationship/overlap with the core team and the pypa which is why I'm asking this here. If that's not true, I can post that question in a more appropriate place. |
The root cause here is that if you insist on not using binaries ( The support added to PEP 517 for self-hosting backends was designed to address this situation, but I don't know if flit has adopted it yet (I can't actually recall offhand if pip has added that support yet). A better solution in this case might be to allow binaries for flit, so you don't get into the loop of using flit to build one of its dependencies in the first place. But I guess whether that works for you depends on why you are using |
Flit doesn't support it yet (I've got a substantial refactor of Flit in the works, trying to find time to complete it). I think support made it into a released pep517 package, so hopefully all pip needs is to vendor the latest version of that. |
I don't see any specific actions targeting pip from the above discussion - any issues with closing this? |
@chrahunt you added "waiting response", did you mean from someone here? I'm not sure if this is a PIP problem, a PEP problem or none of the above. Just a stance from this library would help. Should a build system used by pip have 0 dependancies? If not, then it can cause circular issues if the build system relies on X which uses the build system for its own build. If it can have dependancies, is there a reasonable way to do that? Is vendoring the only way today? Depending on the answer to that question, there may or may not be actions targeting pip. |
Anyone really - just getting confirmation that no one sees a specific action that I missed, then if @techalchemy doesn't respond in some time or another maintainer doesn't remove the label then the bot will close the issue. I would put those questions to the packaging category on Discourse (and/or the distutils-sig mailing list/pypa/packaging-problems repo) and drop a link here so interested parties can provide feedback. They are a bit higher-level than pip itself, and those resources would help expose the discussion to a wider audience who can help define best practices which could make their way into the Packaging User Guide for example. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
Environment
18.0
3.7.0
Ubuntu 18.0.4
I am in the middle of cutting a pipenv release and I am running the vendoring tooling I
stoleborrowed from you guys. This tooling is run viapipenv run invoke vendoring.update
which essentially wraps the command in a virtualenv.Description
The failure is happening when downloading licenses, specifically for
ptyprocess==0.6.0
. The command in question was simply to download the sdist to a target without dependencies. Note that this is functional when disabling build isolation.This is a
ReqTracker
related error, which indicates:Expected behavior
1 sdist in the target directory sans errors
How to Reproduce
Output
The text was updated successfully, but these errors were encountered: