poetry: Cross path dependencies cause SolverProblemError
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: macOS 10.15.5
- Poetry version: 1.1.0
- Link of a Gist with the contents of your pyproject.toml file:
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
and package2
are path dependencies, then poetry lock
fails on:
SolverProblemError
Because poetry-bug-with-cross-path-deps depends on package1 (0.1.0 deps/package1) which depends on package2 (0.2.0 deps/package2), package2 is required.
So, because poetry-bug-with-cross-path-deps depends on package2 (0.2.0 deps/package2), version solving failed.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 6
- Comments: 21 (7 by maintainers)
@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.
@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.
I have the same problem with git dependencies pointing on a specific branch.
@abn
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:
the current project
which directly depends on./deps/package2
.package1
which directly depends on./deps/package2
.package1
as a direct dependency tothe current project
as./deps/package1
.the current project
to still depend directly on./deps/package2
as we don’t want to know what the underlying dependenciespackage1
has.the current project
which depends directly on./deps/package1
and./deps/package2
andpackage1
which depends on./deps/package1/deps/package2
where./deps/package2
and./deps/package1/deps/package2
are different versions ofpackage2
.Poetry 1.1 output is as follows
As far as I understand now this
package2 (0.2.0 deps/package2)
andpackage2 (0.2.0 deps/package2)
refers to different absolute paths which is not clear btw.Also, please notice that both packages have the same version defined in their
pyproject.toml
files. However, as those are different paths (which is unclear) poetry treats them as different versions.Correct me if I’m wrong here.
If this is correct then:
version = "*"
to allow poetry to install at least one of those packages? Preferably it should be the direct dependency effectively falling back to poetry 1.0 behavior.Update:
pyproject.toml
version = "*"
to path-dependency results inRuntimeError
This is expected behaviour. In
1.0
the resolution was incorrectly performed for nested path dependencies. This meant that if you had./deps/package2
and./deps/package1/deps/package2
, when./deps/package1
metadata was inspected while resolving for your root project, build incorrectly selected./deps/package2
as a dependency ofpackage1
when it should have selected,./deps/package1/deps/package2
. This was resolved in1.1
When correctly resolved, you will encounter a solving issue because effectively you have pinned two different versions of
package2
-package2 @ ./deps/package2
andpackage2 @ ./deps/package1/deps/package2
. Two pinned versions pointing to different paths are inherently incompatible.We noticed a similar issue with poetry
1.1.0
and1.1.1
(1.0.10
works fine).We have a
root-project
that depends onhelper
andlib
.lib
also depends onhelper
. All of the dependencies aregit="..." rev="..."
pointing to the same revision.The error we get is:
Note that poetry reports that both dependencies are the same:
But it still reports
SolverProblemError
.@benoit9126 @2m can we capture the git dependency issue in another issue please? Would be great to have an example project as well.
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.