Fixing "No module named google.appengine.dist27.threading" for App Engine
So lately I've been having problems getting App Engine to start locally and actually run my apps.
The problem was I was getting the following error:
No module named google.appengine.dist27.threading
Which can't be good, right ...
So had to look around a bit and found a few tricks that can find what's wrong to get you back on App Engine.
First start Python in verbose mode with:
This will show you all the locations of imports happening.
So when you run:
you'll see a big list of files being loaded where you'll be looking for /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google
If you can't find this, it means some other package is overriding that namespace.
In my case I saw:
... ... <lots of output, I'm not adding to save space ...> ... import google # loaded from Zip /Library/Python/2.7/site-packages/protobuf-3.0.0_alpha_1-py2.7.egg/google/__init__.pyc
Which means that my Python instance is trying to load the
Easy actually, use virtualenv. I should have been probably been using it anyway :\
Run the following in your apps folder with the app.yaml file:
virtualenv --no-site-packages . source bin/activate
You'll notice a environment was created and you'll terminal will now show the name of the folder this is in. If you try to run the dev server again all should be good !
To exit the context of your environment run:
Enjoy, this took me a while to figure out so hopefully this helps a few people.
If I missed something let me know in the comments below.
Posted on 2016/02/11 by Johann du Toitcomments powered by Disqus