uWSGI Fails with No module named encoding Error

Dev Maha picture Dev Maha · Apr 29, 2013 · Viewed 23.3k times · Source

I am trying to setup uWSGI with Pyramid, but I am getting this error, when attempting uwsgi --ini-paste development.ini

Python version: 3.2.3

Error message:

uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3
Python version: 3.2.3 (default, Oct 19 2012, 20:08:46)  [GCC 4.6.3]
Set PythonHome to /root/path/to/virtualenv
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named encodings

Here is what I have in development.ini

[uwsgi]
socket = /tmp/uwsgi.sock
master = true


processes = 4

harakiri = 60
harakiri-verbose = true
limit-post = 65536
post-buffering = 8192

daemonize = ./uwsgi.log
pidfile = ./pid_5000.pid

listen = 256 

max-requests = 1000

reload-on-as = 128 
reload-on-rss = 96
no-orphans = true

log-slow = true
virtualenv = /root/path/to/virtualenv

I suppose I have checked everything possible, including the following

echo LANG:$LANG LC_CTYPE:$LC_CTYPE
LANG:en_US.UTF-8 LC_CTYPE:

I am using virtualenv and uWSGI was installed while the environment was active. I have also checked that my virtual environment's lib has a package named encoding (pointing to my main python3.2 installation)

I have also checked this answer and this

I had previously installed uWSGI when my virtualenv was not active, but then I installed it properly and removed the executable and py files from previous installation.

Is there a way to get detailed logs, please let me know if there is. Thanks in advance

Answer

Louis M picture Louis M · Sep 16, 2016

Check that

virtualenv = /root/path/to/virtualenv

points to the right path. I solved my error by fixing this mistyped path.