Search code examples
pythongoogle-app-enginepycrypto

Can't Use Pycrypto in Google App Engine Production


I am successfully using Pycrypto vs. 2.6 in my GAE development environment under Python 2.7. However, deploying it to Google production I see the following error in the logs:

from Crypto.Cipher import _AES ImportError: cannot import name _AES

My App.Yaml:

application: appname
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: main.app
  secure: always

libraries:
- name: webapp2
  version: "2.5.2"
- name: pycrypto
  version: "2.6"

The Python call in question:

from Crypto.Cipher import AES

Checking Google support documents and they do list Pycrypto 2.6 as supported. I also tried to enter "latest" for the version and received the same error. Again in development GAE on my local machine it works perfectly.


Solution

  • Issue resolved. I had a directory from my Windows installation called "Crypto" in my App Engine project directory. When the app loader loaded the files it also included this directory which conflicted with what Google has loaded in production. Removal of this directory from the local project directory resolved the problem upon the next push to Google.