Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing uwsgi in virtualenv

I'm trying to install uswgi in a virutal env on linux ubuntu, python 3.5.2 I do

pip install uwsgi 

I got this error

Failed building wheel for uwsgi 

and at the end of the installing logs

    *** uWSGI compiling embedded plugins *** [thread 0][x86_64-linux-gnu-gcc -pthread] plugins/python/python_plugin.o [thread 1][x86_64-linux-gnu-gcc -pthread] plugins/python/pyutils.o In file included from plugins/python/python_plugin.c:1:0: plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory compilation terminated. In file included from plugins/python/pyutils.c:1:0: plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory compilation terminated.  ----------------------------------------  Command "/home/ubuntu/envflask/env/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wthov1ur/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-quiupta5-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/envflask/env/include/site/python3.5/uwsgi" failed with error code 1 in /tmp/pip-build-wthov1ur/uwsgi/ 
  • Linux 4.4.0-66-generic x86_64
  • Python 3.5.2

It is any solution for this? Thanks

like image 731
Alvaro B Avatar asked May 18 '17 02:05

Alvaro B


People also ask

How do I know if uwsgi is installed?

Check for the existence of the socket files within the /run/uwsgi directory by typing: sudo ls /run/uwsgi.

Where does pip install uwsgi?

The uwsgi binary is placed in /usr/bin/uwsgi when installing uwsgi this way.

Which Python does uwsgi use?

It appears that uwsgi in the version that is packaged for Ubuntu 18.04. 4 defaults to using the python plugin, which means Python 2.


2 Answers

You need to install Python3.5 development files, so run this command:

apt-get install python3.5-dev 

The above command will install Python 3 headers to build uWSGI from source.

like image 179
McGrady Avatar answered Sep 21 '22 13:09

McGrady


apt-get install build-essential python3-dev

From the uWSGI documentation:

uWSGI is a (big) C application, so you need a C compiler (like gcc or clang) and the Python development headers. On a Debian-based distro an apt-get install build-essential python-dev will be enough.

For Python3, just change that to python3-dev.

$ python3 --version Python 3.5.2 $ pip3 freeze uWSGI==2.0.15

like image 23
JCotton Avatar answered Sep 22 '22 13:09

JCotton