There are many questions regarding
imaplib2 has no attribute IMAP4_SSL but none of the solutions in the other questions worked for me.
I have a python script that's been running without issue for years on AWS, but after I upgraded to
Ubuntu 20.04.2 LTS, it started throwing the error about
IMAP4_SSL. After looking into the issue, I believe it may have something to do with the mappings in Python, but it all looks correct to me. I also checked that there are no other Python versions installed that could cause a conflict.
Here are the paths for Python and the
$ which python3 /usr/bin/python3 $ python3 --version Python 3.8.5 $ whereis python3 '/usr/bin/python3.8-config' '/usr/bin/python3' '/usr/bin/python3.8' '/usr/lib/python3' '/usr/lib/python3.8' '/usr/lib/python3.9' '/etc/python3' '/etc/python3.8' '/usr/local/lib/python3.8' '/usr/include/python3.8' '/usr/share/python3' '/usr/share/man/man1/python3.1.gz' $ sys.path '' '/usr/lib/python38.zip' '/usr/lib/python3.8' '/usr/lib/python3.8/lib-dynload' '/home/ubuntu/.local/lib/python3.8/site-packages' '/usr/local/lib/python3.8/dist-packages' '/usr/lib/python3/dist-packages'
> import imaplib2 > imaplib2.__file__ '/home/ubuntu/.local/lib/python3.8/site-packages/imaplib2/__init__.py'