stone red
stone red

Reputation: 21

ImportError: No module named tablib

I am using "flask+nginx+uwsgi" for my website. Everything works fine at first.Then in order to transform my *.txt file to excel format, I install tablib in my environment and add just "import tablib" into my init.py , then I cannot access my website any more. Once I comment out "import tablib", it works again. And I notice the uwsgi.log, it tells me that:

> *** Operational MODE: preforking *** Traceback (most recent call last):   File "./__init__.py", line 14, in <module>
>     import tablib ImportError: No module named tablib unable to load app 0 (mountpoint='') (callable not found or import error)
> *** no app loaded. going in full dynamic mode ***

I check uwsgi setting carefully and i don't think it's uwsgi that create this error(because whenever I remove "import tablib", everything works perfectly). I also checked the installation of tablib, it was installed successfully. Can anyone give me a suggestion on how to fix this error? thanks a lot!

Upvotes: -1

Views: 3150

Answers (1)

Rishabh Srivastava
Rishabh Srivastava

Reputation: 917

Are you running uwsgi as root? If so, running sudo -H pip install tablib in terminal should fix the issue for you. It is possible that you have installed tablib in your own profile, but not in the root profile.

Upvotes: 0

Related Questions