poetry addするとパッケージのバージョンが合わないとエラーメッセージが出る

目次

エラーメッセージが表示され、ライブラリのインストールができない

poetry add pyinstallerコマンドを実行すると、以下のメッセージが表示され、pyinstallerが導入できません。

~/Pr/pythonProject/TkEasyGUISample/myProject/src/myproject ❯ poetry add pyinstaller                                               11s
Using version ^6.15.0 for pyinstaller

Updating dependencies
Resolving dependencies... (0.0s)

The current project's supported Python range (>=3.13) is not compatible with some of the required packages Python requirement:
  - pyinstaller requires Python <3.15,>=3.8, so it will not be installable for Python >=3.15

Because no versions of pyinstaller match >6.15.0,<7.0.0
 and pyinstaller (6.15.0) requires Python <3.15,>=3.8, pyinstaller is forbidden.
So, because myproject depends on pyinstaller (^6.15.0), version solving failed.

  * Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For pyinstaller, a possible solution would be to set the `python` property to ">=3.13,<3.15"

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

pythonは3.13.6を導入しているはずなのですが。

~/Pr/pythonProject/TkEasyGUISample/myProject/src/myproject ❯ python --version
Python 3.13.6

pyproject.tomlのpythonバージョン指定を変更して解決

エラーメッセージに

For pyinstaller, a possible solution would be to set the `python` property to ">=3.13,<3.15"

とサジェストがある点が気になります。

pyproject.tomlを確認すると、以下のとおりrequires-python = “>=3.13″と指定していました。このtomlファイルはpoetry new コマンドで作成したものです。

[project]
name = "myproject"
version = "0.1.0"
description = ""
authors = [{ name = "python", email = "****@**.com" }]
readme = "README.md"
requires-python = ">=3.13"
dependencies = ["tkeasygui (>=1.0.37,<2.0.0)"]

[tool.poetry]
packages = [{ include = "myproject", from = "src" }]


[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

エラーメッセージの中のサジェストのとおり、“>=3.13,<3.15”に書き換えてみます。

インストールできました。

~/Programing/pythonProject/TkEasyGUISample/myProject ❯ poetry add pyinstaller
Using version ^6.15.0 for pyinstaller

Updating dependencies
Resolving dependencies... (0.8s)

Package operations: 6 installs, 0 updates, 0 removals

  - Installing altgraph (0.17.4)
  - Installing packaging (25.0)
  - Installing setuptools (80.9.0)
  - Installing macholib (1.16.3)
  - Installing pyinstaller-hooks-contrib (2025.8)
  - Installing pyinstaller (6.15.0)
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
目次