Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding PySide2 fails to resolve version #1930

Closed
2 of 3 tasks
madig opened this issue Jan 22, 2020 · 8 comments
Closed
2 of 3 tasks

Adding PySide2 fails to resolve version #1930

madig opened this issue Jan 22, 2020 · 8 comments
Labels
area/docs/faq Frequently duplicated/potential addition to FAQ area/solver Related to the dependency resolver kind/bug Something isn't working as expected

Comments

@madig
Copy link

madig commented Jan 22, 2020

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10, Python 3.8.1
  • Poetry version: 1.0.2
  • Link of a Gist with the contents of your pyproject.toml file: See below

Issue

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\
~\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"
~\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.
@madig madig added the kind/bug Something isn't working as expected label Jan 22, 2020
@madig
Copy link
Author

madig commented Jan 22, 2020

Switching to PyQt5 works around the issue.

@JrooTJunior
Copy link

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.

@finswimmer finswimmer added the area/solver Related to the dependency resolver label Mar 2, 2020
@mnrode
Copy link

mnrode commented Jul 5, 2020

I ran into the same issue.
Changing python = "^3.8" to python = "3.8.3" inside pyproject.toml allowed installation of PySide2.

@finswimmer
Copy link
Member

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

@finswimmer finswimmer added the area/docs/faq Frequently duplicated/potential addition to FAQ label Jul 8, 2020
@atollk
Copy link

atollk commented Jul 8, 2020

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.

@andreas-wolf
Copy link

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.

@nugend
Copy link

nugend commented Jun 11, 2021

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

Is there a good reason to not refer to this feature in the error message?

max-sixty added a commit to PRQL/dbt-prql that referenced this issue Jul 26, 2022
Weirdly this isn't working at the moment -- `poetry install` seems to refuse to recognize that `dbt-core` 1.2.0 exists. I'm having issues in another project upgrading dbt, so possibly there's some issue with the release metadata?

It does not seem to be due to python-poetry/poetry#1930 (comment) in this case.
max-sixty added a commit to PRQL/dbt-prql that referenced this issue Jul 27, 2022
* Upgrade dbt to 1.2.0

Weirdly this isn't working at the moment -- `poetry install` seems to refuse to recognize that `dbt-core` 1.2.0 exists. I'm having issues in another project upgrading dbt, so possibly there's some issue with the release metadata?

It does not seem to be due to python-poetry/poetry#1930 (comment) in this case.
max-sixty added a commit to PRQL/dbt-prql that referenced this issue Jul 27, 2022
* Upgrade dbt to 1.2.0

Weirdly this isn't working at the moment -- `poetry install` seems to refuse to recognize that `dbt-core` 1.2.0 exists. I'm having issues in another project upgrading dbt, so possibly there's some issue with the release metadata?

It does not seem to be due to python-poetry/poetry#1930 (comment) in this case.
spoorn added a commit to spoorn/poeblix that referenced this issue May 28, 2023
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/docs/faq Frequently duplicated/potential addition to FAQ area/solver Related to the dependency resolver kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

7 participants