How to use uWSGI with Python 3.7 in Ubuntu 18.x

Step-by-step how-to guide to use uWSGI with Python 3.7 for Ubuntu 18.04 and 18.10.



In both Ubuntu 18.04 (Bionic Beaver) and 18.10 (Cosmic Cuttlefish) the uWSGI plugin for Python 3 use the default version 3.6.

It’s possible to compile an uWSGI plugin using the official Python 3.7 package, and we will see how to do it step by step.



Install all needed packages to build the plugin

$ sudo apt install \
python3.7 python3.7-dev python3-distutils uwsgi uwsgi-src uuid-dev libcap-dev libpcre3-dev


Build the plugin with correct python version

$ cd ~
$ export PYTHON=python3.7
$ uwsgi --build-plugin "/usr/src/uwsgi/plugins/python python37"


Change the plugin directory and set its permissions

$ sudo mv /usr/lib/uwsgi/plugins/
$ sudo chmod 644 /usr/lib/uwsgi/plugins/


The uWSGI test command with Python 3.7 plugin give the same result for both Ubuntu 18.04 and 18.10.

$ uwsgi --plugin python37 -s :0
Python version: 3.7.1 (default, Oct 22 2018, 11:21:55)  [GCC 8.2.0]

 2019-03-13   1 min read      Howto   #GNU/Linux 🐧 #uWSGI 🇺 #Python 🐍 #Ubuntu 👥