bernie2436
bernie2436

Reputation: 23901

ImportError: No module named tornado.wsgi

I am running python 2.7 on ubuntu 12.04. I did pip install tornado in a virtual environment and python reports that it was a successful installation. But when I run the code in the file tserver.py I get the following error:

(venv)$ python tserver.py 
Traceback (most recent call last):
  File "tserver.py", line 1, in <module>
    from tornado.wsgi import WSGIContainer
ImportError: No module named tornado.wsgi

I found this question describing a very similar problem Python Tornado: WSGI module missing? -- but my file is not called tornado.py so the answer does not help me.

Upvotes: 4

Views: 4124

Answers (1)

akshay pai
akshay pai

Reputation: 122

Had you named the server file initially as tornado.py ? because, I had and even after changing i still got that error.

I fixed it after I did a sudo pip install tornado --upgrade

After this i closed the terminal and restarted it. Then, in the python interpreter i tried import tornado and the error was gone.

Also also remove any tornado.pyc or tornado.py file in the directory where your application is present

Upvotes: 1

Related Questions