poetry-plugin-export: Dependency walk failed with 2 different version of same package
The poetry lock command generated a lock file containing 2 different versions of the same package.
[[package]]
name = "grpcio"
version = "1.49.1
...
[[package]]
name = "grpcio"
version = "1.51.3"
...
This is due to the following dependency constraint in one of the package:
grpcio = [
{version = ">=1.42.0", markers = "python_version >= \"3.10\" and sys_platform != \"darwin\""},
{version = ">=1.42.0,<=1.49.1", markers = "python_version >= \"3.10\" and sys_platform == \"darwin\""},
]
The export command fails with Dependency walk failed at grpcio (>=1.42.0,<=1.49.1)
This happens because the first analyzed dependency choose the 1.51.3
version first. When the grpcio (>=1.42.0,<=1.49.1)
dependency is analyzed (afterwards), the 1.49.1
version is being filtered out here.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 20
- Comments: 21 (5 by maintainers)
Commits related to this issue
- revert to 746555d at least until https://github.com/python-poetry/poetry-plugin-export/issues/183 is resolved — committed to CAST-genomics/haptools by aryarm 6 months ago
- https://github.com/python-poetry/poetry-plugin-export/issues/183 — committed to andrewbolster/bolster by andrewbolster 4 months ago
- NI Water Quality Data (#1009) * Hopefully resolves #1006 * resolved 2023/4 regressions in NI Water data return Also resolved issues with.... * https://github.com/python-poetry/poetry-plugin-expo... — committed to andrewbolster/bolster by andrewbolster 4 months ago
For the
urllib3
workaround, you can add something like:I just ran into this because
botocore
has different range requirements depending on the python version:I am using Poetry 1.7.0 and Python 3.9 and I got this problem today with the following message:
This workaround works for me. Thanks @ekaj2!
I’m currently working around this by doing:
I’m curious to hear how poetry-plugin-export’s output would differ from this (if it were working).
It’s intended and completely valid. The lockfile is environment-independent. This is purely an issue of
poetry-plugin-export
. Although two versions are locked only one is installed.Note: As a workaround, I added an additional dependency
grpcio<=1.49.1
such that1.51.3
is not added to the .lock file. The export works fine in this case.I’m encountering this while trying to use
sentence-transformers
while having to manually specify thetorch
packages to use in order to get the CPU version oftorch
.Minimal reproduction here: https://gist.github.com/colindean/2d9e042ae92a8df86bec4e83b4ce9cc4
That seems to work, though the exact specification could change depending on your python version (boto says it’s fine with
urllib3 2.0.x
for Python 3.10 and up)So the export fails when there’s 2 different versions of
urllib3
, but both versions are placed into the lockfile by Poetry’s dependency resolution. Is that valid/intended? Is that a separate Poetry issue? If so, is it already being tracked on that project? It feels problematic to have 2 different versions of the same package locked and installed.@radoering How would you recommend we solve this within the export plugin? Should there be a flag to only make the
requirements.txt
for the current environment?The workaround of forcing older version of
urllib3
for all downstream libraries is not a viable long-term solution, IMHO.