0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Poetryでインストール時のpythonバージョンに関わるエラー

Posted at

発生したエラー

Poetryでライブラリをインストールしようとすると以下のようなエラーが出ることがあります。
今回はnumpyをインストールしようとしたときのエラーです。

$ poetry add numpy

...

The current project's supported Python range (>=3.10,<4.0) is not compatible with some of the required packages Python requirement:
  - numpy requires Python <3.13,>=3.9, so it will not be satisfied for Python >=3.13,<4.0

Because numpy (1.26.1) requires Python <3.13,>=3.9
 and no versions of numpy match >1.26.1,<2.0.0, numpy is forbidden.
So, because paddy depends on numpy (^1.26.1), version solving failed.

  • 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.10,<3.13"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

解決方法

pyproject.tomlファイルのpythonのバージョンをエラー中の">=3.10,<3.13"に従って書き換え、再度ライブラリをインストールするとうまくいきます。

pyproject.toml
[tool.poetry.dependencies]
python = ">=3.10,<3.13"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?