Reputation: 12607
Using poetry, sometimes when checking for dependency Poetry will indicate that you can't install something because of compatibility issues.
For example, I have on my project numpy==1.19.2
. Now when I try to install pandas
I get the following
$: poetry add pandas
The currently activated Python version 3.6.9 is not supported by the project (>=3.8,<3.11).
Trying to find and use a compatible version.
Using python3.9 (3.9.7)
Using version ^1.3.4 for pandas
Updating dependencies
Resolving dependencies... (0.6s)
SolverProblemError
Because no versions of pandas match >1.3.4,<2.0.0
and pandas (1.3.4) depends on numpy (>=1.20.0), pandas (>=1.3.4,<2.0.0) requires numpy (>=1.20.0).
So, because my_project depends on both numpy (1.19.2) and pandas (^1.3.4), version solving failed.
How can I figure out which pandas
version should I install to be compatible with my version of numpy
?
Upvotes: 8
Views: 6771
Reputation: 1348
If you execute a dry run of the pandas package addition with the *
version qualifier it should resolve to the latest version that is compatible with your other dependencies:
poetry add pandas@* --dry-run
You will see the exact version of pandas that would be installed in the command output. You can then use that version to update the version qualifier in your pyproject.toml
file.
Alternatively, use the *
qualifier directly in the pyproject.toml
file as follows:
[tool.poetry.dependencies]
...
pandas = "*"
...
Upvotes: 16