I'm getting these errors while running a program:

> Traceback (most recent call last):
>  File "parseIMAPemail.py", line 5, in <module>
    from imapclient import IMAPClient
  File "/usr/local/lib/python2.7/dist-packages/imapclient/__init__.py", line 10, in <module>
    from .imapclient import *
  File "/usr/local/lib/python2.7/dist-packages/imapclient/imapclient.py", line 26, in <module>
    from . import tls
  File "/usr/local/lib/python2.7/dist-packages/imapclient/tls.py", line 36, in <module>
  File "/usr/local/lib/python2.7/dist-packages/imapclient/tls.py", line 26, in check_pyopenssl_version
    from OpenSSL import __version__ as installed_pyopenssl_version
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
ImportError: No module named cryptography

I installed the imapclient using the following commands:

 sudo pip install --upgrade setuptools
 wget https://pypi.python.org/packages/source/m/mock/mock-1.3.0.tar.gz
 tar xf mock-1.3.0.tar.gz
 cd mock-1.3.0
 sudo python setup.py install
 sudo apt-get install libffi-dev python-pip --yes
 sudo pip install imapclient


sudo pip install cryptography

Although running mock-1.3.0/setup.py and pip guaranteed all dependencies for mock/imapclient, the same can't be said of your RPi IMAP project code. If it lacks setup.py, it might have other dependencies that require manual installation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.