9

No module named Crypto.Cipher

when I try to import

from Crypto.Cipher import AES

My folder structure looks like this:

test/

test/main.py

test/pycrypto-2.3

I ran the build and install inside of the pycrypto folder but I keep getting the error, any ideas?

Chris
  • 2,739
  • 4
  • 29
  • 57
  • Maybe this will help: http://stackoverflow.com/questions/338768/python-importerror-no-module-named – MByD Mar 27 '11 at 17:07

3 Answers3

5

It does not work with the usual easy_install, or running setup.py, depending on your Mac OS X version. This is due to how Google App Engine only allows for libraries loaded from certain directories. See here for more discussion: http://code.google.com/p/googleappengine/issues/detail?id=1627

Asmo Soinio
  • 1,182
  • 12
  • 12
  • 3
    Thanks for that link! For anyone else, heres what worked on osx 10.8.x and sdk 1.7.4: `sudo easy_install -Z pycrypto`. I had previously tried `pip install pycrypto`, but that didnt work. In the article above they explain why. – Robert Dodd Jul 22 '13 at 01:01
1

You don't need to include pycrypto in your app; you need to install it the standard way for a Python library. If you've done that, the most likely reason it's not working is because you installed it (Eg, using easy_install) for a different version or installation of Python than the one that you're running the dev_appserver with. Macs are particularly notorious for this. Make sure you installed it in the same version of Python as the one the dev_appserver is running.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198
0

Please set PYTHONHOME if you have installed pycrypto in a user-defined directory. Also

/home/user# python -v
>>> from Crypto.Cipher import AES

will give you some idea what's the exact error.

w00t
  • 450
  • 6
  • 10