22

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

1
  • 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, 2014 at 21:05

3 Answers 3

38

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
4
1

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:

and then changing it manually like with the following steps.

First, we unzipped it:

tar xvzf uwsgi-1.9.20.tar.gz

Then, we edited the file uwsgiconfig.py, replacing line 213,

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

To say this instead:

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 file:

sudo pip install uwsgi-1.9.20.tar.gz

And that worked. Hope that helps someone!

1
  • your gcc installation is broken if can't find headers that are installed via standard packages
    – jfs
    Mar 11, 2015 at 22:48
0

To install under Cygwin via pip, need the following packages:

  • gcc-core
  • gcc-g++ (probably)
  • libcrypt-devel
  • libintl-devel
  • python3
  • python3-devel

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .