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:

 

Next install ensure the relevent development source code is installed:

 

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…)

 

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):

 

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

 

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

 

Change it to

 

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)

 

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

vs. the previous

 

by Chris
May 3, 2018