Poetry: version solving failed

Created on 19 Oct 2018  路  5Comments  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: OSX 10.13.6
  • Poetry version: 0.12.3
  • your pyproject.toml file: empty with defaults - no packages added

Issue

poetry add django is resulting in a SolverProblemError.

[SolverProblemError]
The current supported Python versions are *
Because no versions of django match >2.1,<2.1.1 || >2.1.1,<2.1.2 || >2.1.2,<3.0
and django (2.1) requires Python >=3.5, django is forbidden.
And because django (2.1.1) requires Python >=3.5, django is forbidden.
So, because django (2.1.2) requires Python >=3.5
and poetrytest depends on django (^2.1), version solving failed.

Possible fix

While initializing the virtualenv poetry should use the current python version as the default supported python version rather than "*".

Furthermore the error still sounds kinda weird and does not actually say that Django cant be installed, because you can either install a Django version for Python2 or one for Python3, but you cant support all Python versions.

Feature Setup

Most helpful comment

This is the expected behaviour. Since you specified that your project is compatible with any Python versions

Well, here is the thing: i didnt actively think about the consequences while accepting poetries default of "*" for the compatible python versions. And thats my main point.

Yes, poetry is totally right in refusing to install Django. Im not questioning that.
Im saying that by reading the error message its not obviously clear to me that the initial decision (or the lack of) is causing this. And i bet a lot of people are running into that same error.

I kinda answered my own question, why this error is happening, but it still is confusing and caused by poetries default suggestion on init. With a lot of other packages having this split in development for Python2/3 and people still not being aware of problems like the above, why not suggesting another default on init?

That's not possible since Poetry has to lock for any compatible version.

Did you mean look?
I think you misunderstood me. I dont want to suggest that the resolver should work differently. Hell no! I switched from the horribly broken pipenv, because its working better!

I just want poetry to help its users by suggesting a more sane default on init than *.
And the system Python might be a good reference. Dont you think?
Or during the init poetry could ask to take either the latest Python 2/3 version while still offering to type whatever Python version they like.

And maybe the mentioned error above could more clearly point out, that package X cant be installed for all python versions. More like: Please change your Python requirement to (in this case) >=3.5 to be able to install Django.

All 5 comments

This is the expected behavior. Since you specified that your project is compatible with any Python versions but the constraint specified for django is ^2.1 than Poetry cannot find a compatible version because django ^2.1 is only compatible with Python 3.

While initializing the virtualenv poetry should use the current python version as the default supported python version rather than "*".

That's not possible since Poetry has to lock for any compatible version. Only when installing Poetry will use the current environment to determine the packages to install.

This is the expected behaviour. Since you specified that your project is compatible with any Python versions

Well, here is the thing: i didnt actively think about the consequences while accepting poetries default of "*" for the compatible python versions. And thats my main point.

Yes, poetry is totally right in refusing to install Django. Im not questioning that.
Im saying that by reading the error message its not obviously clear to me that the initial decision (or the lack of) is causing this. And i bet a lot of people are running into that same error.

I kinda answered my own question, why this error is happening, but it still is confusing and caused by poetries default suggestion on init. With a lot of other packages having this split in development for Python2/3 and people still not being aware of problems like the above, why not suggesting another default on init?

That's not possible since Poetry has to lock for any compatible version.

Did you mean look?
I think you misunderstood me. I dont want to suggest that the resolver should work differently. Hell no! I switched from the horribly broken pipenv, because its working better!

I just want poetry to help its users by suggesting a more sane default on init than *.
And the system Python might be a good reference. Dont you think?
Or during the init poetry could ask to take either the latest Python 2/3 version while still offering to type whatever Python version they like.

And maybe the mentioned error above could more clearly point out, that package X cant be installed for all python versions. More like: Please change your Python requirement to (in this case) >=3.5 to be able to install Django.

I think it makes sense to to default to the current Python version, I agree. If you initialize the project either with new or init using Python 3.7, for instance, it will default to python = "^3.7". Note that it could still be changed in init if necessary.

Im happy with that way of handling it!

This has been implemented in version 0.12.5.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhrmnn picture jhrmnn  路  3Comments

probablykasper picture probablykasper  路  3Comments

jbarlow83 picture jbarlow83  路  3Comments

EdgyEdgemond picture EdgyEdgemond  路  3Comments

alexlatchford picture alexlatchford  路  3Comments