I get the following error:
~$ sudo apt install build-essential python2.7-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
python2.7-dev is already the newest version (2.7.15-4ubuntu4~18.04.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
~$ which gcc
/usr/bin/gcc
~$ gcc
gcc: fatal error: no input files
compilation terminated.
~$ pip install uwsgi==1.9.20 --index-url=http://192.168.1.200/pypackages/simple/ --trusted-host 192.168.1.200
Collecting uwsgi==1.9.20
Downloading http://192.168.1.200/pypackages/simple/uwsgi/uwsgi-1.9.20.tar.gz (731kB)
100% |████████████████████████████████| 737kB 12.1MB/s
Building wheels for collected packages: uwsgi
Running setup.py bdist_wheel for uwsgi ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-u0AKpd/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp63xyFzpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying uwsgidecorators.py -> build/lib.linux-x86_64-2.7
installing to build/bdist.linux-x86_64/wheel
running install
using profile: buildconf/default.ini
detected include path: ['/usr/lib/gcc/x86_64-linux-gnu/7/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed', '/usr/include/x86_64-linux-gnu', '/usr/include']
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-u0AKpd/uwsgi/setup.py", line 109, in <module>
distclass=uWSGIDistribution,
File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 240, in run
self.run_command('install')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/pip-build-u0AKpd/uwsgi/setup.py", line 71, in run
conf = uc.uConf(get_profile())
File "uwsgiconfig.py", line 627, in __init__
raise Exception("you need a C compiler to build uWSGI")
Exception: you need a C compiler to build uWSGI
The error says I do not have a C compiler but gcc is installed.
uwsgi
is already in the repositories. It might not be version 1.9.20 but it should still work for your needs (and is basically the sameuwsgi
from PyPI except precompiled and installable).For installing it, and its Python 3 plugin, just run:
This will install
uwsgi
and the Python 3 plugin. You can then executeuwsgi --plugin=python3 ...
as normal for running it directly.This said, if you don't want to run things yourself manually (though you may need to in some cases), you can also set up
uwsgi
configuiration files in/etc/uwsgi/*.ini
and then start those services withsudo systemctl stop uwsgi && sudo systemctl start uwsgi
and it'll run daemon-ized automatically. Documentation on that, however, is in uwsgi's documentation, and is too complex and in-depth for me to copy here. I use this to run three APIs for my employer on their infrastructure that're UWSGI based and have data passed into them from web endpoints authorized to access the API points, and it works pretty effectively.