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 
11

2 Answers

Install Python 3:

sudo apt-get install python3 

Install Python 3 headers to build uWSGI from source:

sudo apt-get install python3-dev 

Create a Python 3 virtualenv in a venv subdir of current dir (prepend the command with sudo if current dir is privileged):

virtualenv -p python3 venv 

Activate the venv to be the target for pip (. is a shortcut for source):

. venv/bin/activate 

Finally, install uWSGI (again, sudo if in a privileged dir):

pip install uwsgi 
2

Have you installed the correct python plugin for uwsgi?

Then in config (your .ini file) put python3 as plugin instead of python like this:

[uwsgi] plugins = python3 # Rest of your configuration... 
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.