Poetry: Python requirement (^3.8) is not compatible djangorestframework-simplejwt requires Python >=3.6,<3.9

Created on 22 Aug 2020  路  3Comments  路  Source: python-poetry/poetry

dmugtasimov@dmugtasimov-Latitude-E5550 ~/gitrep/ngineered-studio/mv/mv-server $ poetry init
...

dmugtasimov@dmugtasimov-Latitude-E5550 ~/gitrep/ngineered-studio/mv/mv-server $ poetry add django
Using version ^3.1 for django

Updating dependencies
Resolving dependencies... (2.8s)

Writing lock file


Package operations: 4 installs, 0 updates, 0 removals

  - Installing asgiref (3.2.10)
  - Installing pytz (2020.1)
  - Installing sqlparse (0.3.1)
  - Installing django (3.1)
dmugtasimov@dmugtasimov-Latitude-E5550 ~/gitrep/ngineered-studio/mv/mv-server $ poetry add djangorestframework
Using version ^3.11.1 for djangorestframework

Updating dependencies
Resolving dependencies... (0.4s)

Writing lock file


Package operations: 1 install, 0 updates, 0 removals

  - Installing djangorestframework (3.11.1)
dmugtasimov@dmugtasimov-Latitude-E5550 ~/gitrep/ngineered-studio/mv/mv-server $ poetry add djangorestframework-simplejwt
Using version ^4.4.0 for djangorestframework-simplejwt

Updating dependencies
Resolving dependencies... (2.2s)

[SolverProblemError]
The current project's Python requirement (^3.8) is not compatible with some of the required packages Python requirement:
  - djangorestframework-simplejwt requires Python >=3.6,<3.9

Because no versions of djangorestframework-simplejwt match >4.4.0,<5.0.0
 and djangorestframework-simplejwt (4.4.0) requires Python >=3.6,<3.9, djangorestframework-simplejwt is forbidden.
So, because mv-server depends on djangorestframework-simplejwt (^4.4.0), version solving failed.
Duplicate

Most helpful comment

In case someone needs a workaround while the issue is being fixed (add <3.9 to pyproject.toml).

pyproject.toml:

[tool.poetry.dependencies]
# TODO(dmu) MEDIUM: <3.9 was added as work around for
#                   https://github.com/python-poetry/poetry/issues/2846 . Remove once fixed
python = "^3.8,<3.9"

All 3 comments

I think I hit the same bug, but with a slightly different version requirement >=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <3.9, when I tried to install python-minifier:

$ poetry init
...

$ poetry add python-minifier
Creating virtualenv myapp in /home/tueda/tmp/myapp/.venv
Using version ^2.3.1 for python-minifier

Updating dependencies
Resolving dependencies... (0.0s)

[SolverProblemError]
The current project's Python requirement (^3.8) is not compatible with some of the required packages Python requirement:
  - python-minifier requires Python >=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <3.9

Because no versions of python-minifier match >2.3.1,<3.0.0
 and python-minifier (2.3.1) requires Python >=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <3.9, python-minifier is forbidden.
So, because myapp depends on python-minifier (^2.3.1), version solving failed.


Environment

$ poetry --version
Poetry version 1.0.10

$ poetry env info

Virtualenv
Python:         3.8.5
Implementation: CPython
Path:           /home/tueda/tmp/myapp/.venv
Valid:          True

System
Platform: linux
OS:       posix
Python:   /home/linuxbrew/.linuxbrew/opt/[email protected]

In case someone needs a workaround while the issue is being fixed (add <3.9 to pyproject.toml).

pyproject.toml:

[tool.poetry.dependencies]
# TODO(dmu) MEDIUM: <3.9 was added as work around for
#                   https://github.com/python-poetry/poetry/issues/2846 . Remove once fixed
python = "^3.8,<3.9"

Hello,

it's not a bug nor a fix is required. It's a feature. See https://github.com/python-poetry/poetry/issues/1930#issuecomment-653906544

Was this page helpful?
0 / 5 - 0 ratings

Related issues

probablykasper picture probablykasper  路  3Comments

jackemuk picture jackemuk  路  3Comments

ulope picture ulope  路  3Comments

jbarlow83 picture jbarlow83  路  3Comments

etijskens picture etijskens  路  3Comments