python-social-auth/social-core

"ModuleNotFoundError: No module named 'social'" with Google OAuth 2

philippemilink opened this issue · 2 comments

Hello,

We are using the following packages together:

Django==3.2.21
social-auth-app-django==5.4.0
social-auth-core==4.5.0

with Python 3.11.

When using Google OAuth2, we get the following error after providing Google credentials and coming back to the URL /complete/google-oauth2/...:

ModuleNotFoundError: No module named 'social'
  File "django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "social_django/utils.py", line 49, in wrapper
    return func(request, backend, *args, **kwargs)
  File "social_django/views.py", line 31, in complete
    return do_complete(
  File "social_core/actions.py", line 49, in do_complete
    user = backend.complete(user=user, *args, **kwargs)
  File "social_core/backends/base.py", line 39, in complete
    return self.auth_complete(*args, **kwargs)
  File "social_core/utils.py", line 253, in wrapper
    return func(*args, **kwargs)
  File "social_core/backends/oauth.py", line 424, in auth_complete
    return self.do_auth(
  File "social_core/utils.py", line 253, in wrapper
    return func(*args, **kwargs)
  File "social_core/backends/oauth.py", line 437, in do_auth
    return self.strategy.authenticate(*args, **kwargs)
  File "social_django/strategy.py", line 104, in authenticate
    return authenticate(*args, **kwargs)
  File "django/views/decorators/debug.py", line 42, in sensitive_variables_wrapper
    return func(*func_args, **func_kwargs)
  File "django/contrib/auth/__init__.py", line 76, in authenticate
    user = backend.authenticate(request, **credentials)
  File "social_core/backends/base.py", line 83, in authenticate
    return self.pipeline(pipeline, *args, **kwargs)
  File "social_core/backends/base.py", line 86, in pipeline
    out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs)
  File "social_core/backends/base.py", line 117, in run_pipeline
    func = module_member(name)
  File "social_core/utils.py", line 59, in module_member
    module = import_module(mod)
  File "social_core/utils.py", line 53, in import_module
    __import__(name)

leading to an error 500.

Is there something wrong in our code/configuration, or is it a bug on your side?

nijel commented

There is no social module, it is social_core, so maybe your configuration is wrong?

Indeed... The references to social.* were not updated after migrating to split social.

Sorry for the noise.