Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing 'jose' module #427

Closed
ajharry69 opened this issue Mar 16, 2023 · 3 comments · Fixed by #437
Closed

Fix missing 'jose' module #427

ajharry69 opened this issue Mar 16, 2023 · 3 comments · Fixed by #437
Assignees

Comments

@ajharry69
Copy link

ajharry69 commented Mar 16, 2023

Expected behaviour

I expect all the required packages to be installed after updating to version 5.1.0.

Actual behaviour

I get ModuleNotFoundError - no module named 'jose' after updating to version 5.1.0 (the same error has been reported in the CI server).

What are the steps to reproduce this issue?

  1. Setup social-app-django.
  2. Update/upgrade the dependencies.
  3. Run the tests.
  4. Or, check CI logs.

Any logs, error output, etc?

Traceback (most recent call last):
  File "/home/runner/work/social-app-django/social-app-django/tests/test_admin.py", line 21, in test_admin_app_name
    self.client.login(username="admin", ***)
  File "/home/runner/work/social-app-django/social-app-django/.tox/py310-django22/lib/python3.10/site-packages/django/test/client.py", line 602, in login
    user = authenticate(**credentials)
  File "/home/runner/work/social-app-django/social-app-django/.tox/py310-django22/lib/python3.10/site-packages/django/contrib/auth/__init__.py", line 66, in authenticate
    for backend, backend_path in _get_backends(return_tuples=True):
  File "/home/runner/work/social-app-django/social-app-django/.tox/py310-django22/lib/python3.10/site-packages/django/contrib/auth/__init__.py", line 27, in _get_backends
    backend = load_backend(backend_path)
  File "/home/runner/work/social-app-django/social-app-django/.tox/py310-django22/lib/python3.10/site-packages/django/contrib/auth/__init__.py", line 21, in load_backend
    return import_string(path)()
  File "/home/runner/work/social-app-django/social-app-django/.tox/py310-django22/lib/python3.10/site-packages/django/utils/module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 2[41](https://github.com/python-social-auth/social-app-django/actions/runs/4429665435/jobs/7770411435#step:6:42), in _call_with_frames_removed
  File "/home/runner/work/social-app-django/social-app-django/.tox/py310-django22/lib/python3.10/site-packages/social_core/backends/facebook.py", line 20, in <module>
    from .open_id_connect import OpenIdConnectAuth
  File "/home/runner/work/social-app-django/social-app-django/.tox/py310-django22/lib/python3.10/site-packages/social_core/backends/open_id_connect.py", line 5, in <module>
    from jose import jwk, jwt
ModuleNotFoundError: No module named 'jose'

The stack trace was copied from: https://github.com/python-social-auth/social-app-django/actions/runs/4429665435/jobs/7770411435

Any other comments?

It seems the error only comes up if social-auth-core version 4.4.4 is installed. A possible workaround would be pinning social-auth-core to an older version instead i.e. social-auth-core>=4.3,<4.4.

@nijel
Copy link
Member

nijel commented Mar 16, 2023

Caused by python-social-auth/social-core#590 which makes Facebook backend require openidconnect deps, what was not the case before.

Possible solutions:

  • switch testing in social-app-django to a different backend than facebook
  • add social-auth-core[openidconnect] to test deps for social-app-django
  • split limited Facebook auth to separate module to avoid this dependency
  • make jose dependency non-optional in social-core (and drop PyJWT dependency, see Use a single JWT library social-core#503)

I think splitting Facebook auth or addding jose are the least intrusive solution for now.

@ajharry69
Copy link
Author

add social-auth-core[openidconnect] to test deps for social-app-django

Assuming the quoted solution means replacing social-auth-core >= 4.1.0 with social-auth-core[openidconnect] >= 4.1.0 in the requirements.txt is also a workaround to get the test passing since it will install the supposedly optional python-jose.

@nijel
Copy link
Member

nijel commented Mar 17, 2023

Yes, that's why I prefer a solution in social-core as that would address the issue for all users, not just for social-app-django.

danielpclin added a commit to danielpclin/dmoj_docker that referenced this issue Mar 17, 2023
danielpclin added a commit to danielpclin/dmoj_docker that referenced this issue Mar 24, 2023
@nijel nijel linked a pull request Mar 30, 2023 that will close this issue
9 tasks
@nijel nijel self-assigned this Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants