ResolutionImpossible - Conflicting dependencies while deploying on heroku

While deploying a Django + React project on Heroku, this error occoured:

The conflict is caused by: djoser 2.1.0 depends on social-auth-app-django<5.0.0 and >=4.0.0
rest-social-auth 8.0.0 depends on social-auth-app-django<6.0 and >=5.0

If I downgrade to social-auth-app-django==4.0.0 pkg, then get this error:

raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: WSGI application 'backend.wsgi.application' could not be loaded; Error importing module.

This error is caused by social_django which is added in settings.py

MIDDLEWARE = [
   ....
  # For social auth
  'social_django.middleware.SocialAuthExceptionMiddleware',
  .... 
]

Fixed this error by removing/commenting it out, then found another one:

cannot import name 'urlquote' from 'django.utils.http' (lib\site-packages\django\utils\http.py)

Because urlquote() is no longer available in Django 4.0+ versions, after downgrading social-auth-app-django==4.0.0 pkg. This try to import from django.utils.http import urlquote in filelib\site-packages\social_django\context_processors.py.

I'm in Dependency hell. I have even tried to downgrading the djoser pkg, then got other errors.

After searching a lot, I found this blog post, according to this:

First, pip install pip-tools then create a requirements.in file and add

django
djangorestframework

then run pip-compile ./requirements.in this will generate requirements.txt file:

# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
#    pip-compile ./requirements.in
#
asgiref==3.6.0
    # via django
django==4.1.5
    # via
    #   -r ./requirements.in
    #   djangorestframework
djangorestframework==3.14.0
    # via -r ./requirements.in
pytz==2022.7.1
    # via djangorestframework
sqlparse==0.4.3
    # via django
tzdata==2022.7
    # via django

But this file doesn't contain other packages like:

django-cors-headers,
djoser,
PyJWT
rest-social-auth
social-auth-app-django,
etc....

Please help me with this question, any resource that can help me.

Back to Top