Poetry 发现间接依赖项(python 的 numpy)已过时,但没有更新它

Job*_*obu 4 python-poetry

尝试诗歌 1.1.11 并在我的 pyproject.toml 的 tool.poetry.dependencies 部分中添加 pandas。Pandas 依赖于 numpy

\n
pandas 1.3.3 Powerful data structures for data analysis, time series, and statistics\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 numpy >=1.17.3\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 python-dateutil >=2.7.3\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 six >=1.5 \n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 pytz >=2017.3\n
Run Code Online (Sandbox Code Playgroud)\n

当我打电话时poetry add pandas它时,正确安装了 numpy 1.21.1。Numpy 已经升级到 1.22.2,诗歌也认识到了这一点

\n
poetry show --outdated\nnumpy 1.21.1 1.21.2 NumPy is the fundamental package for array computing with Python.\n
Run Code Online (Sandbox Code Playgroud)\n

但 numpy 并没有被诗歌更新。

\n
poetry update\nUpdating dependencies\nResolving dependencies... (0.3s)\n\nNo dependencies to install or update\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n

编辑2:根据@finswimmer的请求,这里是TOML,并且是比第一个编辑TOML更简单的情况。这是一个来自 的空项目poetry new。然后尝试poetry add numpy如下。

\n

只是

\n
[tool.poetry]\nname = "delete_me4"\nversion = "0.1.0"\ndescription = ""\nauthors = ["Your Name <you@example.com>"]\n\n[tool.poetry.dependencies]\npython = "^3.9"\n\n[tool.poetry.dev-dependencies]\npytest = "^5.2"\n\n[build-system]\nrequires = ["poetry-core>=1.0.0"]\nbuild-backend = "poetry.core.masonry.api"\n
Run Code Online (Sandbox Code Playgroud)\n
\xe2\x9d\xaf poetry add numpy\nUsing version ^1.21.2 for numpy\n\nUpdating dependencies\nResolving dependencies... (0.0s)\n\n  SolverProblemError\n\n  The current project's Python requirement (>=3.9,<4.0) is not compatible with some of the required packages Python requirement:\n    - numpy requires Python >=3.7,<3.11, so it will not be satisfied for Python >=3.11,<4.0\n  \n  Because numpy (1.21.2) requires Python >=3.7,<3.11\n   and no versions of numpy match >1.21.2,<2.0.0, numpy is forbidden.\n  So, because delete-me4 depends on numpy (^1.21.2), version solving failed.\n\n  at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:241 in _solve\n      237\xe2\x94\x82             packages = result.packages\n      238\xe2\x94\x82         except OverrideNeeded as e:\n      239\xe2\x94\x82             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)\n      240\xe2\x94\x82         except SolveFailure as e:\n    \xe2\x86\x92 241\xe2\x94\x82             raise SolverProblemError(e)\n      242\xe2\x94\x82 \n      243\xe2\x94\x82         results = dict(\n      244\xe2\x94\x82             depth_first_search(\n      245\xe2\x94\x82                 PackageNode(self._package, packages), aggregate_package_nodes\n\n  \xe2\x80\xa2 Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties\n    \n    For numpy, a possible solution would be to set the `python` property to ">=3.9,<3.11"\n\n    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,\n    https://python-poetry.org/docs/dependency-specification/#using-environment-markers\n
Run Code Online (Sandbox Code Playgroud)\n

Job*_*obu 5

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

[tool.poetry.dependencies]
python = ">=3.9,<3.11"
Run Code Online (Sandbox Code Playgroud)

我不确定是什么触发了它想要 Python >= 3.11 descoped,但是嘿。当我尝试重现后,它解决了我的问题。

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

[tool.poetry.dependencies]
python = ">=3.9,<3.10"
Run Code Online (Sandbox Code Playgroud)