Reputation: 631
Trying out poetry 1.1.11 and have pandas in my pyproject.toml in the tool.poetry.dependencies section. Pandas depends on numpy
pandas 1.3.3 Powerful data structures for data analysis, time series, and statistics
├── numpy >=1.17.3
├── python-dateutil >=2.7.3
│ └── six >=1.5
└── pytz >=2017.3
When I called poetry add pandas
it correctly installed numpy 1.21.1. Numpy has bumped to 1.22.2 and poetry recognizes this
poetry show --outdated
numpy 1.21.1 1.21.2 NumPy is the fundamental package for array computing with Python.
But numpy isn't updated by poetry.
poetry update
Updating dependencies
Resolving dependencies... (0.3s)
No dependencies to install or update
Is this expected? How / when would numpy be updated?
EDIT2: per @finswimmer's request, here's the TOML and for a simpler case than in the first EDIT TOML. It's an empty project from poetry new
. Then try poetry add numpy
as below.
Just
[tool.poetry]
name = "delete_me4"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.9"
[tool.poetry.dev-dependencies]
pytest = "^5.2"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
❯ poetry add numpy
Using version ^1.21.2 for numpy
Updating dependencies
Resolving dependencies... (0.0s)
SolverProblemError
The current project's Python requirement (>=3.9,<4.0) is not compatible with some of the required packages Python requirement:
- numpy requires Python >=3.7,<3.11, so it will not be satisfied for Python >=3.11,<4.0
Because numpy (1.21.2) requires Python >=3.7,<3.11
and no versions of numpy match >1.21.2,<2.0.0, numpy is forbidden.
So, because delete-me4 depends on numpy (^1.21.2), version solving failed.
at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
• Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
For numpy, a possible solution would be to set the `python` property to ">=3.9,<3.11"
https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
https://python-poetry.org/docs/dependency-specification/#using-environment-markers
Upvotes: 4
Views: 3416
Reputation: 631
The suggestion in the help text above addresses the issue. poetry add numpy
works in an empty project with this TOML change.
[tool.poetry.dependencies]
python = ">=3.9,<3.11"
I'm not sure what triggered it wanting Python >= 3.11 descoped, but hey. It solved the problem for me once I tried the repro.
Note that constraining Python further as follows allows for scipy to move from 1.6.1 to 1.7.1
[tool.poetry.dependencies]
python = ">=3.9,<3.10"
Upvotes: 5