Search code examples
pythonpython-2.7google-app-engine

Can't import google.appengine.api


This should be pretty basic as I've installed lots of Python packages, but I can't for the life of my get Google APIs client library for python to install.

I'm pressure sure I've gone through the instructions on this website properly: https://developers.google.com/api-client-library/python/start/installation

To summarize I've done the following:

$ easy_install --upgrade google-api-python-client

this seems to work fine, doesn't report any errors or warnings

Downloaded and unzipped google-api-python-client-gae-1.2.zip into the directory where my project is.

But if I open an iPython session in the folder where I unpacked the full dependencies I can't do the basic imports such as:

import google.appengine.api it just says

"No Module named google.appengine.api"

I checked in my site-packages folder and google_api_python_client-1.2-py2.7.egg is there. But it doesn't show up in sys.path

when I do sys.path.append('C:\Anaconda\Lib\site-packages\google_api_python_cli ent-1.2-py2.7.egg') it adds the correct path, but the import still doesn't work.

EDIT: This fixed my problem

Adding the Google SDK to my Python path did the trick. I don't know why the installer didn't do this when I ran it. but hey, this worked

So if I run:

sys.path.append('C:\\Program Files (x86)\\Google\\google_appengine')

from google.appengine import api

works!


Solution

  • Without knowing all the steps you took to install app engine and the client APIs, my only recommendation is to install (or reinstall) the Google App Engine Python SDK from here: https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python. Looks like you're on windows, so you would grab the MSI.

    Just make sure you launch the AppEngineLauncher application after installation as it will give you the option to create symlinks so you can run commands from terminal.