DEV Community

Cover image for How to use uWSGI with python3.6 in Ubuntu

How to use uWSGI with python3.6 in Ubuntu

Paolo Melchiorre on April 04, 2017

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 libca...
Collapse
 
jorgii profile image
George Goranov •

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 and plugin=python36 to the other and at the end both try to run with python36. Only when I remove /usr/lib/uwsgi/plugins/python36_plugin.so then uwsgi runs python3.5

The weirder thing is that running uwsgi --plugin python36 -s :0 and uwsgi --plugin python35 -s :0 spawns it with the correct version of python.

Any idea what could cause it?

Collapse
 
jorgii profile image
George Goranov •

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.

Collapse
 
pauloxnet profile image
Paolo Melchiorre •

Hi George and thanks to shared your solutions.

Collapse
 
karolyi profile image
László Károlyi •

also install:

  • uuid-dev
  • libcap-dev
  • libpcre3-dev
Collapse
 
pauloxnet profile image
Paolo Melchiorre •

Hi László this packages are not-direct dependencies from the packages I suggested to install ?

Collapse
 
karolyi profile image
László Károlyi •

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.

Thread Thread
 
pauloxnet profile image
Paolo Melchiorre •

You are right! I've updated the howto. Thanks for your suggestions.

Collapse
 
sindhujit profile image
sindhujit •

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.

Collapse
 
pauloxnet profile image
Paolo Melchiorre •

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 ?

Collapse
 
sindhujit profile image
sindhujit • • Edited

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

Thread Thread
 
pauloxnet profile image
Paolo Melchiorre •

Sorry but I never tried this instructions with a Red Hat, as I reported this instructions are for Ubuntu.

Collapse
 
dertee profile image
DerTee •

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