Search code examples
pythonpython-poetry

Poetry not updating sub dependencies despite version constraint allowing it


My code is using a package (taskiq), which in turn depends on another package (pycron). Why is poetry update not updating pycron despite version constraints allowing it?

$ poetry update
Updating dependencies
Resolving dependencies... (2.2s)

No dependencies to install or update

$ poetry show -o                                                  
pycron    3.0.0  3.1.1  Simple cron-like parser, which determines if current datetime matches conditions.

$ poetry show --why --tree pycron   
taskiq 0.11.10 Distributed task queue with full async support
└── pycron >=3.0.0,<4.0.0

Solution

  • You can answer such questions by insisting that poetry install the latest version of the project that you expect to be updated eg poetry add "pycron>=3.1.1"

    Then one of three things will happen:

    • poetry will refuse to make that change and will tell you the conflict that prevents it from doing so
    • poetry will make the change: but to make that work it will have to downgrade something else. This happens when the latest versions of two packages conflict in some way, but a solution can be found by downgrading either one of them.
    • (very unlikely) poetry will make the change without downgrading anything else, and you will still be confused about why it did not do so in the first place