Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uWSGI Fails with No module named encoding Error

Tags:

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

like image 603
Dev Maha Avatar asked Apr 29 '13 06:04

Dev Maha


2 Answers

Check that

virtualenv = /root/path/to/virtualenv 

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

like image 160
Louis M Avatar answered Sep 29 '22 20:09

Louis M


in my case it was basically because I used python 2.7 as main interpreter, and uwsgi choose pyhon3 plugin. You might need to force it using:

plugins=python32

where python32is appropriate name for your pythhon3 plugin.

Have you checked this: uwsgi python3 plugin doesn't work?

like image 31
jb. Avatar answered Sep 29 '22 19:09

jb.