-
Notifications
You must be signed in to change notification settings - Fork 2.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
Cross path dependencies cause SolverProblemError #3030
Comments
Hello @atugushev, the problem here is, that you the Your folder structure looks like this:
So you have fin swimmer |
Hi @finswimmer, Thanks for your suggestion. In the real-world |
Hello @atugushev, can you add more detail what you mean by "submodules" here exactly? At the end of the day, you cannot install two different packages with the same name. So I guess your task must be solved in another way. Happy to help here, but for that I need to understand what the task is :) fin swimmer |
I have the same problem with git dependencies pointing on a specific branch.
|
That's right. It's git submodules. |
@finswimmer actually, it doesn't matter here why the paths are like that. This is a real-world scenario that works in 1.0. Basically, what happens here is that there are two packages specified via relative paths. In case one of the packages specifies the path which is already specified in the root package as its local dependency poetry fails to resolve the dependencies. The poetry 1.0 behavior was to look for this path relative to the root package's dir. Whether this is good behavior or not is not relevant. That behavior worked and was intuitively expected. Indeed, if package1 specifies package2 as its dependency and package2 could be found and installed according to the specification in package1 dependencies it is expected for this to work. P.S.: This issue is not a feature request or proposal. This is a bug report regarding an expected behavior that is broken in poetry 1.1. I'd advise treating this one accordingly. |
We noticed a similar issue with poetry We have a The error we get is:
Note that poetry reports that both dependencies are the same:
But it still reports |
This is expected behaviour. In When correctly resolved, you will encounter a solving issue because effectively you have pinned two different versions of |
@abn I agree with you with path dependencies: two different paths must be considered as two different dependencies. Nevertheless, with the example of @2m, the dependency is the same git repository at the same revision... It must be considered as the same dependency and be valid. Idem with git dependencies pointing to the same branch on the same repository. |
The question is how they are included. Hence why my comment above asking for clarification. Submodules are path dependencies, not git dependencies from a poetry/pep-508 perspective.
To be clear, they can be the same dependency, but are considered two specific versions of it. |
I can not answer for @2m but I have troubles with git dependencies of the form
Thanks! |
In my case all dependencies are provided as git dependencies, like so:
I will try the fix provided in #3105 a bit later and will report back. |
Tried poetry from #3105 and still got the same error as in #3030 (comment) |
@benoit9126 @2m can we capture the git dependency issue in another issue please? Would be great to have an example project as well. |
I tried to reproduce the problem I noticed in a minimized example but could not get the same error. Will try harder a bit later. |
Created a separate issue with a reproducer project: #3113 |
I'm deeply sorry, but the 1.0 behavior is actually expected and logical behavior. With 1.1 behavior it is impossible to install dependencies in this case. The case is:
Poetry 1.1 output is as follows
As far as I understand now this Also, please notice that both packages have the same version defined in their Correct me if I'm wrong here. If this is correct then:
Update:
|
Basically, Poetry 1.1.0-1.1.2 is not working at the moment for the case for which Poetry 1.0 was working at least in some way. |
@lig am I right that your expectation about the dependency resolution is like that: Whenever poetry finds a path dependency, it should read the name and the version from there. When its finished to collect all these information, it should decide based on that which path dependency it installs. While this sounds reasonable on the first sight, this is not how it works or how it should work. A package from different sources must be treated as different version, regardless of which version number is defined. This is why the path is interpreted as a pinned version. And if you have a package with two different pinned version in your dependency graph, you cannot resolve it. Why must we treat different sources as different version? Well, we cannot guarantee that they are the same package. Maybe it's a coincidence that the name is equal? fin swimmer |
@finswimmer the reality is that whilst the software cannot guarantee something people are not dumb and could guarantee that via a policy on which they agreed on. In that case, the software needs to stand aside and allow people to handle that. I want to state "I know what I'm doing" and software should be able to obey that. |
Just in case... Relative paths themselves do work, and they are allowed to have That is, if you replace If all "dependency packages" are stored in the "deps" folder, any "dep" package may depend on any set of the other "dep" packages. This is entirely possible. In particular, in the following scenario,
The only inconvenience with this approach is that you would no longer be able to work with "package1" as with a normal standalone self-sufficient project elsewhere. The most simple workaround is to create a dummy wrapper project:
Personally, I use this approach extensively, and it works fairly well for me. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option).Issue
If a project (e.g.,
poetry-bug-with-cross-path-deps
) has the following dependencies:poetry-bug-with-cross-path-deps
depends onpackage1
poetry-bug-with-cross-path-deps
depends onpackage2
package1
depends onpackage2
and the
package1
andpackage2
are path dependencies, thenpoetry lock
fails on:The text was updated successfully, but these errors were encountered: