How to install uWSGI with asyncio on Mac (OS X 10.10 Yosemite)

The installation of uWSGI + Asyncio is defined in the uWSGI documentation however I’ve run into many troubles. So in this tutorial I’m trying to make it a bit easier.

I’m assuming that you have Homebrew, Python 3.4 and Virtualenv already installed. If that’s not the case, you should follow this tutorial first.

Installing Greenlet

First thing we need to do is installing greenlet in our global python3.4 interpreter.

pip3 install greenlet

Why in the global Python3 interpreter? Why not in the virtualenv just running pip install greenlet?
This is because the python header files don’t get copied to a virtualenv and we’ll need to point to them when building uWSGI + Asyncio.

Get the Python3.4 include path

Now we need to find the Python3.4 include path. We know that greenlet must be there already so lets try to find it:

sudo find / -name greenlet -type d

Result obtained: /usr/local/include/python3.4m/greenlet
So now we know that the Python3.4 include path is: /usr/local/include/python3.4m.

Install uWSGI + Asyncio

Finally we just need to activate our Virtualenv and run the following command:

CFLAGS="-I/usr/local/include/python3.4m" UWSGI_PROFILE="asyncio" pip install uwsgi

Don’t forget to replace the CFLAGS with the include path you got in the previous step.

Comments 1

Leave a Reply to Vinicius Cancel reply

Your email address will not be published. Required fields are marked *