1. 環境
(.venv) user$ python --version
Python 3.7.6
(.venv) user$ poetry -V
Poetry version 1.0.3
2. 現象
Cythonをインストールする時に以下のようなSolverProblemError
が発生.
(.venv) user$ poetry install
Installing dependencies from lock file
Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.
[SolverProblemError]
Because annotator depends on Cython (0.29.15) which doesn't match any versions, version solving failed.
Cythonは0.29.15
で指定していた.
pyproject.toml
...
[tool.poetry.dependencies]
Cython = "0.29.15"
...
3. 解決策
poetry add
ならいける.
(.venv) user$ poetry add Cython
Using version ^0.29.15 for Cython
Updating dependencies
Resolving dependencies... (0.4s)
Package operations: 1 install, 0 updates, 0 removals
- Installing cython (0.29.15)
poetry add
だと自動的にバージョンを^
で指定する.
pyproject.toml
...
[tool.poetry.dependencies]
Cython = "^0.29.15"
...
どうやらこれが必要だった模様.
Cython=0.29.15
はpypiにもあるし,ドキュメント
によるとこの方法で指定すると>= 0.29.15 < 1.0.0
になるはずなので0.29.15
指定でも良さそうなものだが...
ちなみにadd
じゃなくてもCython = "^0.29.15"
で指定してinstall
でもいける.
(.venv) user$ poetry install
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing cython (0.29.15)