Cannot resolve module ‘imaplib2’ has no attribute ‘IMAP4_SSL’

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 imaplib2 package

$ which python3

$ python3 --version
Python 3.8.5

$ whereis python3

$ sys.path
> import imaplib2
> imaplib2.__file__

Read more here:

Content Attribution

This content was originally published by RHPT at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: