Step-by-step how-to to use uWSGI with python3.6 for Ubuntu 16.10+:
$ sudo apt-get install python3.6 python3.6-dev uwsgi uwsgi-src uuid-dev libcap-dev libpcre3-dev
$ cd ~
$ PYTHON=python3.6 uwsgi --build-plugin "/usr/src/uwsgi/plugins/python python36"
$ sudo mv python36_plugin.so /usr/lib/uwsgi/plugins/python36_plugin.so
$ sudo chmod 644 /usr/lib/uwsgi/plugins/python36_plugin.so
$ uwsgi --plugin python36 -s :0 # Ubuntu 16.10
...
Python version: 3.6.0b2 (default, Oct 11 2016, 05:27:10) [GCC 6.2.0 20161005]
...
$ uwsgi --plugin python36 -s :0 # Ubuntu 17.04
...
Python version: 3.6.1 (default, Mar 22 2017, 06:17:05) [GCC 6.3.0 20170321]
...
Originally posted on www.paulox.net
Top comments (12)
I have an issue with that solution. When I run multiple apps with uwsgin (configs in /etc/uwsgi/apps-available) the plugin option does not seem to work.
I put
plugin=python35
to one andplugin=python36
to the other and at the end both try to run withpython36
. Only when I remove/usr/lib/uwsgi/plugins/python36_plugin.so
then uwsgi runs python3.5The weirder thing is that running
uwsgi --plugin python36 -s :0
anduwsgi --plugin python35 -s :0
spawns it with the correct version of python.Any idea what could cause it?
Managed to solve my issue!
I have installed uwsgi package for ubuntu (16.10).
Afterwards I installed uwsgi-emperor where I copied my previous configs.
Another issue that I had was master=True in the apps .ini files. This should be False to be able to run multiple python versions.
Hi George and thanks to shared your solutions.
also install:
Hi László this packages are not-direct dependencies from the packages I suggested to install ?
not really, at least not on my system, that is why I added them here. you can try it for yourself on a virtual machine with a fresh install.
You are right! I've updated the howto. Thanks for your suggestions.
I have tried a lot of things, even the Master = False, but I am getting "Internal Server Error" on my front-end. Uwsgi works with python2.7 , but is not working with 3.6.
This post is related to use python3.6 with old version of Ubuntu.
Have you tried the steps in above post and verified the result ?
Yes I have. This is a redhat rhel distro. Everything works with python2.7. It fails with 3.6. Is it because I have diff versions of python? However each has its own virtualenv. The uwsgi plugin does not seem to work with python3.6. I get unable to find python3.6 plugin when I try to build it
Sorry but I never tried this instructions with a Red Hat, as I reported this instructions are for Ubuntu.
just tried to compile, got an error about a missing openssl include file and found out that i also had to:
sudo apt-get install libssl-dev