The big picture is that I want Ubuntu server with nginx, uWGI, and Python 3 (virtualenv) to start some project.
I did follow recommendation that can be found on various places. When trying to install uWSGI using the sudo pip install uwsgi
, I do observe the following error:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
I did find the [J.F.Sebastian's comment][1] from September 2012 about the neccessity to $ sudo apt-get install python2.7-dev
-- it was for Python 2.7. So, I did the similar for Python 3.4 (seems successfully). However, I still observer the error.
When trying to search for the Python.h
, I can find:
$ locate Python.h
/usr/include/python3.4m/Python.h
What else should I set to make uWSGI installed? (I am rather new to Ubuntu Linux, even though I did work with Unix far in the middle age ;)
Update:
Following the jwalker's advice from the comment below, I did pip install uwsgi
from within activated virtualenv and without sudo
. But then the installer cannot create subdirectories (like build
) in the venv directory. I tried to chmod go+w
for the venv, but it did not help. I admit I know nothing about virtualenv and pip, and also my Unix knowledge is a bit rusty:
...
File "/var/www/hec_project/hec_venv/lib/python3.4/site-packages/pip/req.py", line 218, in build_location
_make_build_dir(build_dir)
File "/var/www/hec_project/hec_venv/lib/python3.4/site-packages/pip/req.py", line 1527, in _make_build_dir
os.makedirs(build_dir)
File "/var/www/hec_project/hec_venv/lib/python3.4/os.py", line 237, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/www/hec_project/hec_venv/build'
Storing debug log for failure in /home/hecadmin/.pip/pip.log
Install Python 3:
Install Python 3 headers to build uWSGI from source:
Create a Python 3 virtualenv in a
venv
subdir of current dir (prepend the command withsudo
if current dir is privileged):Activate the venv to be the target for
pip
(.
is a shortcut forsource
):Finally, install uWSGI (again,
sudo
if in a privileged dir):Have you installed the correct python plugin for uwsgi?
http://packages.ubuntu.com/precise/uwsgi-plugin-python3
Then in config (your .ini file) put python3 as plugin instead of python like this: