gpt4 book ai didi

python-poetry - 诗歌看到一个间接依赖(python 的 numpy)已经过时,但没有更新它

转载 作者:行者123 更新时间:2023-12-05 01:57:31 28 4
gpt4 key购买 nike

试用 poetry 1.1.11 并在我的 pyproject.toml 的 tool.poetry.dependencies 部分中添加 pandas。 Pandas 依赖于 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

当我调用 poetry add pandas 时,它正确安装了 numpy 1.21.1。 Numpy 已经升级到 1.22.2 并且 poetry 认识到这一点

poetry show --outdated
numpy 1.21.1 1.21.2 NumPy is the fundamental package for array computing with Python.

但是 numpy 不会被诗歌更新。

poetry update
Updating dependencies
Resolving dependencies... (0.3s)

No dependencies to install or update

这是预期的吗? numpy 如何/何时更新?

EDIT2:根据@finswimmer 的要求,这是 TOML 并且比第一个 EDIT TOML 更简单。这是一个来自 poetry new 的空项目。然后尝试 poetry add numpy 如下。

只是

[tool.poetry]
name = "delete_me4"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[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

最佳答案

上面帮助文本中的建议解决了这个问题。 poetry add numpy 使用此 TOML 更改在空项目中工作。

[tool.poetry.dependencies]
python = ">=3.9,<3.11"

我不确定是什么触发了它想要 Python >= 3.11 去范围,但是嘿。一旦我尝试了重现,它就解决了我的问题。

请注意,如下进一步限制 Python 允许 scipy 从 1.6.1 移动到 1.7.1

[tool.poetry.dependencies]
python = ">=3.9,<3.10"

关于python-poetry - 诗歌看到一个间接依赖(python 的 numpy)已经过时,但没有更新它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69238785/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com