Michael C. O'Connor
Michael C. O'Connor

Reputation: 9890

ImportError on inspect in Flask WSGI deployment

I'm trying to deploy a "hello world" Flask app via mod_wsgi, but I haven't been able to get around what's presumably a Python pathing issue.

The traceback ends with

File "/home/moconnor/testenv/lib/python2.7/site-packages/werkzeug/exceptions.py", line 61, in <module>
    from werkzeug._internal import HTTP_STATUS_CODES, _get_environ
File "/home/moconnor/testenv/lib/python2.7/site-packages/werkzeug/_internal.py", line 11, in <module>
    import inspect
ImportError: No module named inspect

and my WSGI file contains:

import sys

activate_this = '/home/moconnor/testenv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

sys.path.insert(0,'/home/moconnor/public/testapp/')
from testapp import app as application

Things work fine in the development server, and I have no problems when doing this import from the shell with the virtualenv active. What am I missing here?

Upvotes: 1

Views: 934

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

The 'inspect' module is a built in Python module.

I can only imagine that your virtual environment is broken in some way, or you are trying to use a virtual environment constructed with one Python version with a mod_wsgi installation which was compiled against a completely different major/minor version.

Verify what version of Python mod_wsgi is compiled for.

Try rebuilding your virtual environment.

Upvotes: 3

Related Questions