Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Welcome,

Currently I'm trying to install latest uwsgi on my VPS (Ubuntu 11.10) based on instruction from the site http://projects.unbit.it/uwsgi/wiki/Quickstart

pip install uwsgi

During compilation I see some errors:

...
[gcc -pthread] spooler.o
*** uWSGI compiling embedded plugins ***
[gcc -pthread] plugins/python/python_plugin.o
Complete output from command /usr/bin/python -c "import setuptools;__file__='/etc/apt/sources.list.d/build/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-joud1I-record/install-record.txt:
running install

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.

using profile: buildconf/default.ini

detected include path: ['/usr/lib/gcc/i686-linux-gnu/4.6.1/include','/usr/local/include', '/usr/lib/gcc/i686-linux-gnu/4.6.1/include-fixed', '/usr/include/i386-linux-gnu', '/usr/include']

Patching "bin_name" to properly install_scripts dir
...

And finally I see:

...

[gcc -pthread] spooler.o

*** uWSGI compiling embedded plugins ***

[gcc -pthread] plugins/python/python_plugin.o

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/etc/apt/sources.list.d/build/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-joud1I-record/install-record.txt failed with error code 1 in /etc/apt/sources.list.d/build/uwsgi
Storing complete log in /root/.pip/pip.log

Has anyone any suggestions how can I install latest uwsgi?

Regards, Grzegorz

share|improve this question
1  
What turned out after following all advice above is that instead of running pip3 install uwsgi I should run the command as root: sudo pip3 install uwsgi –  tomekwi Feb 25 '14 at 21:05

2 Answers 2

up vote 23 down vote accepted

plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory

To compile C extensions for Python you need Python development files:

$ sudo apt-get install python2.7-dev
share|improve this answer
    
Thanks. Now, it works. –  Grzegorz Sep 1 '12 at 9:44
    
Perfect, thanks. –  Zulu Apr 27 '13 at 15:22
    
@J.F.Sebastian: Please, have a look at the related askubuntu.com/q/499206/306605. Thanks. –  pepr Jul 18 '14 at 6:45
    
@J.F.Sebastian: ... or stackoverflow.com/q/24822829/1346705 –  pepr Jul 18 '14 at 10:28
    
Had the same error on Debian Wheezy with Python 3.4, this helped, thanks! –  fnkr Mar 25 at 13:24

Just so will be here in case someone else comes across this problem - Even though we had installed python2.7-dev successfully we still got this error.

What apparently was the problem was gcc's inability to find the libraries which were included in the build script pip was trying to run.

we actually ended up getting the uwsgi pip zip: https://pypi.python.org/packages/source/u/uWSGI/uwsgi-1.9.20.tar.gz

and then changing it manually like with the following steps -

First, we unzipped it:

$ tar xvzf uwsgi-1.9.20.tar.gz

Them, we editted the file: uwsgiconfig.py, replacing line 213:

cmdline = "%s -c %s -o %s %s" % (GCC, cflags, objfile, srcfile)

to:

cmdline = "%s -I/usr/include/libxml2 -c %s -o %s %s" % (GCC, cflags, objfile, srcfile)

Basically, letting gcc know that your libraries are at /usr/include/libxml2 (this was our case at least)

After that, we rezipped the folder:

$ tar cvf uwsgi-1.9.20.tar uwsgi-1.9.20/

$ gzip uwsgi-1.9.20.tar

And used pip with that gzip:

$ sudo pip install uwsgi-1.9.20.tar.gz

And that worked..

Hope that helps someone!

share|improve this answer
    
your gcc installation is broken if can't find headers that are installed via standard packages –  J.F. Sebastian Mar 11 at 22:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.