Search code examples
pythondependenciesversiondependency-management

Dependencies in requirements.txt file creates a conflic when using correct version


When I run my requirements.txt file I get the following error messages

ERROR: Cannot install PyJWT==2.0.0 and djangorestframework-jwt==1.11.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested PyJWT==2.0.0
    djangorestframework-jwt 1.11.0 depends on PyJWT<2.0.0 and >=1.5.2
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

The two dependencies are written like the following:

  • PyJWT==2.0.0
  • djangorestframework-jwt==1.11.0

But what I'm most confused about is the error messages part saying: djangorestframework-jwt 1.11.0 depends on PyJWT<2.0.0 and >=1.5.2

Wouldn't the PyJWT version 2.0.0 be good enough?


Solution

  • This kind of conflict is a pain in the ass. Pip says that the version must be between PyJWT<2.0.0 and >=1.5.2, sou you can use the exact 2.0.0.

    Downgrade it to PyJWT==1.7.1 and it should works!