If you’ve installed uWSGI on Amazon Linux (or a CentOS 6.0 derivative) and its python plugin from yum, then you’ve probabaly noticed when starting the uWSGI service that the python plugin is running against python 2.6.x

If, like me, you could really do with uWSGI running against python 3.6 then you need to compile the python 3.6 module from scratch (other OS’s including those with the epel7 repo (i.e. CentOS 7.0 and derivatives) already have a python3 plugin option you can just install…).

The following instructions describe how to build and enable the plugin on Amazon Linux but the instructions should be equally valid for CentOS 6.0:


First setup a folder to build the plugin in and enter it:

mkdir -p /build/uwsgi-python3
cd /build/uwsgi-python3/


Next install ensure the relevent development source code is installed:

yum install python36-devel uwsgi-devel uuid-devel libcap-devel pcre-devel openssl-devel


Then sym-link link the following header file so the build process can find it (not sure why it’s looking in the wrong place here…)

ln -s /usr/include/uuid.h /usr/include/uuid/uuid.h


Run the build command (note at the time of writing the version of uWSGI installed via yum is 20.0.16 – if you use an earlier or later version your path int he build command here might differ slightly):

PYTHON=python3.6 uwsgi --build-plugin "/usr/src/uwsgi/2.0.16/plugins/python python36"


Copy the compiled plugin to the uwsgi plugins folder and set permissions

cp -a python36_plugin.so /usr/lib64/uwsgi/
chmod 644 /usr/lib64/uwsgi/python36_plugin.so


Edit your uwsgi config file (/etc/uwsgi.ini) to reference the new plugin i.e. where you probabaly have something like the following line:

plugin = python,http


Change it to

plugin = python36,http


Restart uwsgi (NB: I seem to have to do a stop-start vs. a restart on my system to allow enough time for uwsgi to stop fully before starting again)

service uwsgi stop
service uwsgi start


And you should now see something like this in /var/log/uwsgi.log:

Python version: 3.6.5 (default, Apr 26 2018, 00:14:31)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
Python main interpreter initialized at 0x2403540

vs. the previous

Python version: 2.6.9 (unknown, Nov  2 2017, 19:21:21)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
Python main interpreter initialized at 0xcd7e20


by Chris
May 3, 2018