Question

install python uwsgi error

I successfully installed uwsgi on local. But i installed on vps then it’s error. Currently I do not know how to fix it. Error message:

*** uWSGI compiling embedded plugins ***
    [Gcc -pthread] plugins / python / python_plugin.o
    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
     #include <Python.h>
                        ^
    Compilation terminated.
    
    ----------------------------------------
"/usr/bin/python2.7 -u -c" import setuptools, tokenize; __ file __ = '/ tmp / pip-build-oONRqq / superset / setup.py'; f = getattr (tokenize, 'open', open Exec (compile (code, __file__, 'exec')) "install - (__ file __); code = f.read () replace ('\ r \ n', '\ n' -record /tmp/pip-ktDXj1-record/install-record.txt --single-version-externally-managed --compile "failed with error code 1 in / tmp / pip-build-oONRqq /

I look forward to your help. Thanks you


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
June 11, 2023

Heya,

The error message you’re seeing is because Python development files are missing in your system. When uWSGI is trying to compile its Python plugin, it’s not able to find the necessary Python header files (Python.h).

To solve this issue, you need to install Python development files. If you are using Python 2.7, as suggested by the error message, you can install the necessary files using the following command:

sudo apt-get install python-dev

If you are using Python 3, you should install the Python 3 development files instead:

sudo apt-get install python3-dev

After you’ve installed the Python development files, you should be able to install uWSGI without any issues.

If you plan to use Python 3, make sure you’re using the correct version of pip (use pip3 instead of pip) and python (use python3 instead of python) commands in your installation process.

Hi @pmtrit1010

It’s a little unclear what you’ve tried, but that error looks like you’re trying to compile Python, but don’t have all the files available.

There’s a lot of tutorials on setting up uWSGI here on DigitalOcean: https://www.digitalocean.com/community/tutorials?q=uwsgi https://www.digitalocean.com/community/tutorials?q=uwsgi+centos

Maybe this one is what you’re looking for? https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-centos-7

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel