Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install uWSGI on Ubuntu 14.04 with Python 3.4 (paths?)

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
like image 401
pepr Avatar asked Jul 18 '14 10:07

pepr


1 Answers

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:

[uwsgi]
plugins         = python3

# Rest of your configuration...
like image 194
danius Avatar answered Oct 13 '22 07:10

danius