domainaware / parsedmarc

A Python package and CLI for parsing aggregate and forensic DMARC reports
https://domainaware.github.io/parsedmarc/
Apache License 2.0
1.01k stars 217 forks source link

ImportError: cannot import name 'SIGNATURE_RSA' from 'oauthlib.oauth1' #318

Closed zlobniyshurik closed 2 years ago

zlobniyshurik commented 2 years ago

I am tried to setup parsedmarc on Alma Linux 9 Beta (minimal install) and got error after starting parsedmarc.service:

May 09 11:12:14 dmarc.mydomain.tld systemd[1]: parsedmarc.service: Scheduled restart job, restart counter is at 5.
May 09 11:12:14 dmarc.mydomain.tld systemd[1]: Stopped parsedmarc mailbox watcher.
May 09 11:12:14 dmarc.mydomain.tld systemd[1]: Started parsedmarc mailbox watcher.
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]: Traceback (most recent call last):
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/bin/parsedmarc", line 5, in <module>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     from parsedmarc.cli import _main
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/parsedmarc/__init__.py", line 31, in <mod
ule>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     from parsedmarc.mail import MailboxConnection
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/parsedmarc/mail/__init__.py", line 3, in
<module>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     from parsedmarc.mail.gmail import GmailConnection
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/parsedmarc/mail/gmail.py", line 10, in <m
odule>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     from google_auth_oauthlib.flow import InstalledAppFlow
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/google_auth_oauthlib/__init__.py", line 2
1, in <module>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     from .interactive import get_user_credentials
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/google_auth_oauthlib/interactive.py", lin
e 27, in <module>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     import google_auth_oauthlib.flow
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/google_auth_oauthlib/flow.py", line 69, i
n <module>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     import google_auth_oauthlib.helpers
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/google_auth_oauthlib/helpers.py", line 28
, in <module>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     import requests_oauthlib
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/requests_oauthlib/__init__.py", line 4, i
n <module>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     from .oauth1_session import OAuth1Session
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:   File "/usr/local/lib/python3.9/site-packages/requests_oauthlib/oauth1_session.py", lin
e 12, in <module>
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]:     from oauthlib.oauth1 import SIGNATURE_HMAC, SIGNATURE_RSA, SIGNATURE_TYPE_AUTH_HEADE
R
May 09 11:12:14 dmarc.mydomain.tld parsedmarc[82860]: ImportError: cannot import name 'SIGNATURE_RSA' from 'oauthlib.oauth1' (/usr/lib/python3
.9/site-packages/oauthlib/oauth1/__init__.py)
May 09 11:12:14 dmarc.mydomain.tld systemd[1]: parsedmarc.service: Main process exited, code=exited, status=1/FAILURE
May 09 11:12:14 dmarc.mydomain.tld systemd[1]: parsedmarc.service: Failed with result 'exit-code'.

How I can fix it?

Alma Linux 9 Beta Python 3.9.10 parsedmarc 8.0.3

UPD. I checked /usr/lib/python3.9/site-packages/oauthlib/oauth1/__init__.py Indeed, there no 'SIGNATURE_RSA', but 'SIGNATURE_RSA_SHA256' and 'SIGNATURE_RSA_SHA512' instead.

nathanthorpe commented 2 years ago

Can you check what version of the oauthlib you have? pip show oauthlib It should be 3.2.0.

If it's not that version, can you try running pip install oauthlib==3.2.0?

zlobniyshurik commented 2 years ago

My oauthlib version was 3.1.1, after upgrading to 3.2.0 parsedmarc at least started without errors. Hooray! :)