Repository navigation
Open
Labels
area/solverRelated to the dependency resolverRelated to the dependency resolverkind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged
Description
- Poetry version: 1.7.1
- Python version: 3.11
- OS version and name: macOS 14.1.1
- pyproject.toml:
[tool.poetry]
name = "poetrytemp"
[tool.poetry.dependencies]
python = "^3.11"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
I can reproduce this in an empty poetry project.
- attempt to
poetry add -vv 'django-distill[amazon]'
output is like:
Resolving dependencies...
1: fact: poetrytemp is 0.1.0
1: derived: poetrytemp
1: fact: poetrytemp depends on django-distill (^3.1.3)
1: selecting poetrytemp (0.1.0)
1: derived: django-distill[amazon] (>=3.1.3,<4.0.0)
1: fact: django-distill (3.1.3) depends on django-distill (3.1.3)
1: fact: django-distill (3.1.3) depends on django (*)
1: fact: django-distill (3.1.3) depends on requests (*)
1: fact: django-distill (3.1.3) depends on boto3 (*)
1: selecting django-distill[amazon] (3.1.3)
1: derived: boto3
1: derived: requests
1: derived: django
1: derived: django-distill (==3.1.3)
1: fact: django-distill (3.1.3) depends on django (*)
1: fact: django-distill (3.1.3) depends on requests (*)
1: selecting django-distill (3.1.3)
1: fact: django (5.0) depends on asgiref (>=3.7.0)
1: fact: django (5.0) depends on sqlparse (>=0.3.1)
1: fact: django (5.0) depends on tzdata (*)
1: selecting django (5.0)
1: derived: tzdata
1: derived: sqlparse (>=0.3.1)
1: derived: asgiref (>=3.7.0)
1: fact: requests (2.31.0) depends on charset-normalizer (>=2,<4)
1: fact: requests (2.31.0) depends on idna (>=2.5,<4)
1: fact: requests (2.31.0) depends on urllib3 (>=1.21.1,<3)
1: fact: requests (2.31.0) depends on certifi (>=2017.4.17)
1: selecting requests (2.31.0)
1: derived: certifi (>=2017.4.17)
1: derived: urllib3 (>=1.21.1,<3)
1: derived: idna (>=2.5,<4)
1: derived: charset-normalizer (>=2,<4)
1: selecting urllib3 (2.1.0)
1: selecting certifi (2023.11.17)
1: selecting charset-normalizer (3.3.2)
1: selecting idna (3.6)
1: selecting sqlparse (0.4.4)
1: selecting asgiref (3.7.2)
1: fact: boto3 (1.34.7) depends on botocore (>=1.34.7,<1.35.0)
1: fact: boto3 (1.34.7) depends on jmespath (>=0.7.1,<2.0.0)
1: fact: boto3 (1.34.7) depends on s3transfer (>=0.10.0,<0.11.0)
1: selecting boto3 (1.34.7)
1: derived: s3transfer (>=0.10.0,<0.11.0)
1: derived: jmespath (>=0.7.1,<2.0.0)
1: derived: botocore (>=1.34.7,<1.35.0)
1: fact: s3transfer (0.10.0) depends on botocore (>=1.33.2,<2.0a.0)
1: selecting s3transfer (0.10.0)
1: fact: botocore (1.34.7) depends on jmespath (>=0.7.1,<2.0.0)
1: fact: botocore (1.34.7) depends on python-dateutil (>=2.1,<3.0.0)
1: fact: botocore (1.34.7) depends on urllib3 (>=1.25.4,<2.1)
1: derived: not botocore (==1.34.7)
1: fact: no versions of botocore match >1.34.7,<1.35.0
1: conflict: no versions of botocore match >1.34.7,<1.35.0
1: derived: not botocore (>1.34.7,<1.35.0)
1: conflict: botocore (1.34.7) depends on urllib3 (>=1.25.4,<2.1)
1: ! botocore (==1.34.7) is partially satisfied by not botocore (>1.34.7,<1.35.0)
1: ! which is caused by "no versions of botocore match >1.34.7,<1.35.0"
1: ! thus: botocore (>=1.34.7,<1.35.0) requires urllib3 (>=1.25.4,<2.1)
1: fact: botocore (>=1.34.7,<1.35.0) requires urllib3 (>=1.25.4,<2.1)
1: derived: not botocore (>=1.34.7,<1.35.0)
1: derived: not boto3 (==1.34.7)
2: selecting certifi (2023.11.17)
2: selecting charset-normalizer (3.3.2)
2: selecting idna (3.6)
2: selecting sqlparse (0.4.4)
2: selecting asgiref (3.7.2)
2: fact: boto3 (1.34.6) depends on botocore (>=1.34.6,<1.35.0)
2: fact: boto3 (1.34.6) depends on jmespath (>=0.7.1,<2.0.0)
2: fact: boto3 (1.34.6) depends on s3transfer (>=0.10.0,<0.11.0)
2: selecting boto3 (1.34.6)
2: derived: s3transfer (>=0.10.0,<0.11.0)
2: derived: jmespath (>=0.7.1,<2.0.0)
2: derived: botocore (>=1.34.6,<1.35.0)
2: fact: s3transfer (0.10.0) depends on botocore (>=1.33.2,<2.0a.0)
2: selecting s3transfer (0.10.0)
2: fact: botocore (1.34.6) depends on jmespath (>=0.7.1,<2.0.0)
2: fact: botocore (1.34.6) depends on python-dateutil (>=2.1,<3.0.0)
2: fact: botocore (1.34.6) depends on urllib3 (>=1.25.4,<2.1)
2: derived: not botocore (==1.34.6)
2: fact: no versions of botocore match >1.34.6,<1.34.7
2: conflict: no versions of botocore match >1.34.6,<1.34.7
2: derived: not botocore (>1.34.6,<1.34.7)
2: conflict: botocore (1.34.6) depends on urllib3 (>=1.25.4,<2.1)
2: ! botocore (==1.34.6) is partially satisfied by not botocore (>1.34.6,<1.34.7)
2: ! which is caused by "no versions of botocore match >1.34.6,<1.34.7"
2: ! thus: botocore (>=1.34.6,<1.34.7) requires urllib3 (>=1.25.4,<2.1)
this continues forever in a fruitless search, downloading the wheel for every minor version of botocore
the problem seems to be something to do with urllib3
1: fact: requests (2.31.0) depends on urllib3 (>=1.21.1,<3)
1: derived: urllib3 (>=1.21.1,<3)
1: selecting urllib3 (2.1.0)
1: fact: botocore (1.34.7) depends on urllib3 (>=1.25.4,<2.1)
1: conflict: botocore (1.34.7) depends on urllib3 (>=1.25.4,<2.1)
1: ! botocore (==1.34.7) is partially satisfied by not botocore (>1.34.7,<1.35.0)
1: ! which is caused by "no versions of botocore match >1.34.7,<1.35.0"
1: ! thus: botocore (>=1.34.7,<1.35.0) requires urllib3 (>=1.25.4,<2.1)
1: fact: botocore (>=1.34.7,<1.35.0) requires urllib3 (>=1.25.4,<2.1)
it's not clear from the output why https://pypi.org/project/urllib3/1.26.18/ couldn't be used to satisfy >=1.25.4,<2.1
Ok but then the odd thing is if I do this:
poetry add boto3poetry add 'django-distill[amazon]'
then it works fine!
If we look at the setup.py for django-distill: https://github.com/meeb/django-distill/blob/v3.1.3/setup.py#L30
it specifies:
extras_require = {
'amazon': ['boto3'],So no version constraint on boto3.
It doesn't make much sense that dependency resolution fails one way but not the other?
Reacted by Dave Bunten and MajorDallas
Metadata
Metadata
Assignees
Labels
area/solverRelated to the dependency resolverRelated to the dependency resolverkind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged
Activity
dimbleby commentedon Dec 26, 2023
boto3 and urllib3 are known to be an unhappy pairing, you will find lots of similar issues if you search. Current view is that there is nothing much to be done about it, sorry.
please close.
d33bs commentedon Feb 1, 2024
Thanks for opening this issue @anentropic ! I ran into a similar pattern recently and found that the following the workaround you mentioned helped too.
@dimbleby - thanks too for your highlighting the related elements and that there may be a pattern at hand! If it already exists, could you link to the relevant issue, PR, or discussion where boto3 and urllib3 incompatibilities are tracked? I'd mostly suggest this to be sure others who run into the same problem can understand the context and make sure a resolution eventually is addressed. Even if this isn't directly a Poetry issue to solve, it does exhibit itself through the use of the tool, so it could be helpful to make sure others are informed (especially as this can result in a lot of time through attempted dependency resolution).
dimbleby commentedon Feb 4, 2024
@d33bs
please do that yourself if you want to find the similar issues, feel free to add links
Northo commentedon Feb 6, 2024
Thanks for the workaround, @anentropic!
As @d33bs writes, this issue exhibits itself through Poetry, so some warning or other user facing information in these situations would be great!
ps. for future searches, we hit this when installing
fiftyoneanentropic commentedon Feb 6, 2024
similar issues:
most of these: https://github.com/python-poetry/poetry/issues?q=is%3Aissue+boto3+is%3Aclosed
Poetry cannot correctly select dependencies #5896 ... this comment on there appears to say that the version solving will eventually succeed if you can wait long enough for it to exhaust literally all boto3 versions before it tries reducing the urllib3 version.
My first thought is that some sort of bisecting strategy might help it converge on the working solution quicker.
I guess the issue is Poetry feels that just because boto3 1.34.0 and 1.33.0 both require
urllib3 (>=1.25.4,<2.1)it can't trust that somewhere in the middle say boto3 1.33.8 might randomly allow urllib3 2.1.0, and then it has found the absolute latest version of boto3 and urllib3 that satisfy the constraints, which was only possible by exhaustively searching every boto3 version.So there are two fixes users could take right now:
boto3to a specific version, e.g. explicitly installboto3first, thus causing theurllib3 <2.1constraint to get enforced immediatelyurllib3 <2.1would have the same effectFWIW pdm seems to cope with this fine:
all resolved in a reasonable amount of time.
So I wonder what they're doing differently.
dimbleby commentedon Feb 6, 2024
it's just good or bad luck whether your solver happens first to explore a path that fixes boto3 first (when it is very easy to find a satisfactory urllib3) or a path that fixes urllib3 first (when it is very hard to find a satisfactory boto3)
pdm has its own pathological cases!
dimbleby commentedon Feb 6, 2024
the most useful thing you can do right now, for future-you and the rest of the ecosystem, is to go and offer merge requests to
django-distillorfiftyoneor whoever, putting a (recent) lower bound on theirboto3dependency.Then no installer is exposed to having to backtrack through the thousands of versions of
boto3that amazon releaseMajorDallas commentedon Aug 20, 2024
I've run into this issue with Celery 5.4.0. I don't need
boto3or the relatedsqspackage that Celery directly has as an optional dependency, so the workaround I want is to simply exclude thesqsextra. I thought that havingextrasset inpyproject.tomlwould mean that those and only those extras would be pulled in, but despite setting it with exactly the extras I do want for Celery (and Kombu) it continues to insist on downloading every single release ofboto3.It usually takes about 950 seconds before it starts downloading anything. I'm a little afraid that setting Celery to 5.4.0 will make all
poetry lockruns in the future take 20+ minutes because of a package I don't even want and am trying to exclude.Edit: Apparently the
pytest-celerypackage (from mydevgroup) can also pull insqsand that was why Poetry seemed to be ignoring theextrasI gave for Celery itself. I didn't find that sooner becauseboto3was being installed for the first time and sopoetry show --treedidn't list these packages and what was pulling them in. Overall an incredibly frustrating experience, but at least fixing that has it working in the usual 5 seconds or so.dimbleby commentedon Aug 20, 2024
hard to guess what happened to you, but neither celery nor pytest-celery is problematic
MajorDallas commentedon Aug 20, 2024
Probably a result of changing several dependency specs all at once, and one hack that I remember made sense at the time but was probably the real culprit.
When I ran
poetry update celeryorpoetry lock, it would take 20 minutes to get to the point where it started downloading everybotocorerelease. I never let it run to completion, and the furthest it got after several attempts wasbotocore1.15.44 (that particular run was 1098.3s).It seems that having
celery[pytest]was equivalent to havingpytest-celery[all], which then pulled insqsand thusboto3.edit:
hrm, I thought the diff would make it pretty clear, but not really... The problematic config was:
when previously celery was set to 5.3.6 and pytest-celery matched to that automatically. I believe
sqsis a new extra for both Celery and pytest-celery as of 5.4, but I could be wrong.dimbleby commentedon Aug 20, 2024
still locks in about five seconds for me.
Yes there are cases that cause a lot of backtracking. Quite possibly you hit one, though you are unable to say what it was.
But there still is nothing much to be done about it.
As I said back in February: the most useful thing you can do right now, for future-you and the rest of the ecosystem, is to go and offer merge requests to django-distill or fiftyone or whoever, putting a (recent) lower bound on their boto3 dependency.
Then no installer is exposed to having to backtrack through the thousands of versions of boto3 that amazon release
MajorDallas commentedon Aug 21, 2024
Be that is it may, I probably could have resolved the case if I at least knew why
botocorewas being pulled in. I'd never even heard ofbotocorebefore yesterday, andpoetry showwas (correctly, I guess) saying there was nothing to show becausebotocore(andsqsandboto3) wasn't actually installed. It took most of the afternoon to figure outpytest-celerywas the culprit. A simple message would have saved me a lot of time and frustration:d33bs commentedon Aug 21, 2024
Love the idea of a message which @MajorDallas suggested! Perhaps this isn't in scope for Poetry to fix, but developers often may have to dig deeply to find where the error may be coming from with little notification at the moment from Poetry by default. Maybe a timed notification for long-running procedures related to one dependency resolution could help! For example, if the resolution process is taking an excessive amount of time (i.e. longer than an hour or whatever is reasonable) an additional message appears during the process to notify the user about which dependency is causing the jam.
dimbleby commentedon Aug 21, 2024
Verbose logging output already includes such information
MajorDallas commentedon Aug 22, 2024
That is good to know, and I'm a little embarrassed it didn't occur to me try it 😅
Still, I agree with d33bs: if it can be detected that things are taking longer than normal (say, more than 10 minutes or more than 30 backtracking steps), a message about what is being is resolved (without needing a
vor three) would be nice. That makes it a simple decision for the user whether to wait it out or revise the declared dependencies.