Search code examples
pythongoogle-app-enginegcloud-pythongoogle-cloud-python

Installing gcloud after GoogleAppEngineLauncher webapp2 import not found


I've been running GoogleAppEngineLauncher for a couple days, without incident.

This morning I installed the gcloud package from Google.

The issue is that now, regardless of where I run my AppEngine project from (GoogleAppEngineLauncher or using dev_appserver.py) it immediately 500's and the log is:

  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/Users/roger/python/app.myapp/main.py", line 1, in <module>
    import webapp2
ImportError: No module named webapp2

I'm not entirely sure what happened to it, but webapp2 is clearly an important module for the application! It was working seamlessly previous to installing gcloud.

Any help is greatly appreciated.


Solution

  • I ran into the same problem yesterday and although I could not find why it was happening, I did manage to fix the problem.

    I assume you did something similar to me where I installed gcloud using: "pip install --user gcloud" and got a ton of libraries installed into my site-packages directory. (I am using Mac OS X 10.11) What I found is that although I do a pip uninstall gcloud, a bunch of libraries are left behind. To fix the problem I deleted the following libraries from my site-packages directory:

    gcloud
    protobuf*
    google
    

    dev_appserver.py now can find the webapp module.

    Here is the complete list of everything it installed if you want to delete it:

    gcloud
    gcloud-0.13.0.dist-info
    google
    googleapis_common_protos-1.1.0-py2.7-nspkg.pth
    googleapis_common_protos-1.1.0-py2.7.egg-info
    httplib2
    httplib2-0.9.2-py2.7.egg-info
    oauth2client
    oauth2client-2.0.2-py2.7.egg-info
    protobuf-3.0.0b2.post2-py2.7-nspkg.pth
    protobuf-3.0.0b2.post2.dist-info
    pyasn1
    pyasn1-0.1.9.dist-info
    pyasn1_modules
    pyasn1_modules-0.0.8.dist-info
    rsa
    rsa-3.4.2.dist-info
    

    Now someone better than me, needs to explain why this happened.

    Finally the best way I found to install gcloud is using the instruction here: https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27