Can't load jinja2 with webapp2/Google App Engine
Question: I'm going through the GAE webapp2 tutorial (runtime 2.7) using
GoogleAppEngineLauncher on my Mac, and though I'm following everything
exactly, I keep on getting an error at the point where we import the Jinja2
module: [Using Templates - Google App
Engine](http://code.google.com/appengine/docs/python/gettingstartedpython27/templates.html)

**Error:**

> Traceback (most recent call last): File
> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-
> default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py",
> line 168, in Handle handler =
> _config_handle.add_wsgi_middleware(self._LoadHandler()) File
> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-
> default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py",
> line 206, in _LoadHandler handler = import(path[0]) File
> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-
> default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",
> line 640, in Decorate return func(self, *args, **kwargs) File
> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-
> default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",
> line 1756, in load_module return self.FindAndLoadModule(submodule, fullname,
> search_path) File
> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-
> default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",
> line 640, in Decorate return func(self, *args, **kwargs) File
> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-
> default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",
> line 1628, in FindAndLoadModule description) File
> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-
> default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",
> line 640, in Decorate return func(self, *args, **kwargs) File
> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-
> default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",
> line 1571, in LoadModuleRestricted description) File
> "/Users/ykessler/Dropbox/appgrinders/gae_apps/helloworld2.7/helloworld.py",
> line 9, in import jinja2 ImportError: No module named jinja2

So it for some reason can't find the module, even though it's supposed to be
packaged as part of webapp2's extras. When I do a search on my file system it
looks like it's there:

    
    
    /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2_extras/jinja2.py
    

And if I deploy the app to GAE, it works fine. Why would it be failing
locally?


Answer: webapp2 packages its own jinja2 'glue' module, which is what you're importing,
but it doesn't package jinja2 itself. If you want to use it, you'll need to
install it in your system Python using easy_install, or put it in your app's
directory.

