Search code examples
pythonpycrypto

PyCrypto Dependency issue with py3compat


I have pycrypto 2.6.1 installed but I still get this error when trying to importRSA.

>>> from Crypto.Cipher import AES
>>> from Crypto.PublicKey import RSA
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/Crypto/PublicKey/RSA.py", line 73, in <module>
ImportError: No module named py3compat
>>>

As you can see, there is no problem trying to import AES but an issue when trying to import RSA.


Solution

  • This was due to all my site-packages packages being owned by root.

    I got around this issue by installing everything locally (for the current user) like this:

    pip install pycrypto --user

    and this way I had all my packages automatically install without any problems.