from Crypto import Random -> ImportError: cannot import name Random

Looks like the Windows install has that package as crpyto, not Crypto. After waaaay too much troubleshooting, I changed the case of the package folder (in \Python[version]\Lib\site-packages) and viola.


You may have another Crypto module in your Python package. You can check that with

import Crypto
print(Crypto.__file__)
# should print /usr/lib/python2.6/dist-packages/Crypto/__init__.pyc

If you find another Crypto module, either rename/remove it or adjust sys.path

Also, your version of pycrypto may be outdated. Check Crypto.__version__ - Crypto.Random exists since 2.1.0alpha1.


You mentioned that you installed Crypto in
/usr/local/lib/python2.6/dist-packages/Crypto/.

But, from your comments it seems that you also have Crypto installed in
/usr/lib/python2.6/dist-packages/Crypto/.

Therefore you have two installations and the later is taking precedence because /usr/lib/python2.6/dist-packages/ appears first in sys.path.

I had the exact same problem and fixed it by renaming /usr/lib/python2.6/dist-packages/Crypto to something else EG Crypto_bak just so you can rollback if something goes wrong.