-vvv option).Adding PySide2 as a dependency seems to trigger a resolver bug. See below. python = "^3.8" seems to clash with PySide2's limiter < 3.9. The package can be installed without problems in a 3.8.1 venv (pyside2 5.14.0 only works on Python 3.8.1+ on Windows).
~\AppData\Local\Temp
> poetry new ppp
Created package ppp in ppp
~\AppData\Local\Temp
> cd .\ppp\
md5-cd2d25d5ec1bc67f8c37644834bb56ea
~\AppData\Local\Temp\ppp
> cat .\pyproject.toml
[tool.poetry]
name = "ppp"
version = "0.1.0"
description = ""
authors = ["..."]
[tool.poetry.dependencies]
python = "^3.8"
[tool.poetry.dev-dependencies]
pytest = "^5.2"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
md5-cd2d25d5ec1bc67f8c37644834bb56ea
~\AppData\Local\Temp\ppp
> poetry add pyside2=="^5.14"
Creating virtualenv ppp in C:\...\Temp\ppp\.venv
Updating dependencies
Resolving dependencies...
[SolverProblemError]
The current project's Python requirement (^3.8) is not compatible with some of the required packages Python requirement:
- pyside2 requires Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.9
Because no versions of pyside2 match >5.14,<6.0
and pyside2 (5.14.0) requires Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.9, pyside2 is forbidden. So, because ppp depends on pyside2 (^5.14), version solving failed.
Switching to PyQt5 works around the issue.
Switching to PyQt5 works around the issue.
You propose is very bad solution in this case because PySide2 and PyQt5 has different licenses.
PyQt5 is not related with this problem. That's bug in poetry.
I ran into the same issue.
Changing python = "^3.8" to python = "3.8.3" inside pyproject.toml allowed installation of PySide2.
Hello,
when poetry resolves the dependency it tries to find a package version that is compatible to all python version, to which the project is compatible. In your case ^3.8 which means every python version >=3.8 and <4.0. pyside2 is not support for python >=3.9. So the dependency resolution fails.
The solution is to restrict the python version your project is compatible, e.g. ~3.8 which means >=3.8,<3.9.
If there exist an package that is compatible for a specific python version, one could also add those constraints to the pyproject.toml. See here.
fin swimmer
Wouldn't be it useful to improve the error message? Apparently multiple users are or were confused by it.
I think the natural interpretation of the syntax "Python = ^3.8" would be "My code requires features from 3.8, so use any Python version at least 3.8 that works with all packages". It seems intuitive that Poetry would handle the compatibility and find that Python 3.9 is not an option.
case ^3.8 which means every python version >=3.8 and <4.0.
In my view, that is a really bad design, because it's counter intuitive. For every person on the planet who had to deal with regular expressions (mostly developers) ^3.8 means: _starts with 3.8_ which clearly does not include 3.9 while your definition does.
But ok, that probably can not be changed any more. So I go with >=3.8 and 3.8.* and omit ^3.8
For others as reference here is the documentation for the caret sign.
Most helpful comment
Wouldn't be it useful to improve the error message? Apparently multiple users are or were confused by it.
I think the natural interpretation of the syntax "Python = ^3.8" would be "My code requires features from 3.8, so use any Python version at least 3.8 that works with all packages". It seems intuitive that Poetry would handle the compatibility and find that Python 3.9 is not an option.