[PYTHON] A story about trying to install uwsgi on an EC2 instance and failing

Overview

I installed uwsgi on my EC2 instance and it failed, so Troubleshooting notes

background

Originally, I made a web application using the python framework "Django". When I try to run it on EC2 with nginx + wsgi, it feels like an error occurred during installation. I have no development experience, so why did you try to work with that specification? If you get stuck in (No particular reason) I think I will answer, but I will refer to it if you comment.

environment

EC2 instance specs

procedure

So install it on your EC2 instance

pip install uwsgi

When I tried, I got an error like this.

Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-pV1pAc/uwsgi/setup.py", line 124, in distclass=uWSGIDistribution, File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup dist.run_commands() File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/usr/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 215, in run self.run_command('install') File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command self.distribution.run_command(command) File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/tmp/pip-build-pV1pAc/uwsgi/setup.py", line 77, in run conf = uc.uConf(get_profile()) File "uwsgiconfig.py", line 742, in init raise Exception("you need a C compiler to build uWSGI") Exception: you need a C compiler to build uWSGI


Failed building wheel for uwsgi

I need a C compiler! I got angry. Now let's use the C compiler.

And I tried google.

As a result, I didn't have the Development Tool installed, so Let's install it.

sudo yum groupinstall "Development Tools"

You can now install it. So install it again.

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>

Compiling has stopped.

Wow. .. .. Really? .. .. I was angry that there was no file, so I googled again. Reference article: http://zashikiro.hateblo.jp/entry/2012/10/02/130031

So, I installed a package called python2.7-dev. sudo yum install python-devel You should now be able to see Python.h.

Let's try again.

Then. .. ..

Collecting uwsgi Using cached uwsgi-2.0.14.tar.gz Building wheels for collected packages: uwsgi Running setup.py bdist_wheel for uwsgi ... done Stored in directory: /root/.cache/pip/wheels/c4/ad/56/f70a70b63fa4b0f2c0518db6f41381c9d33cd5cc5ac9a9494b Successfully built uwsgi Installing collected packages: uwsgi Successfully installed uwsgi-2.0.14

I was able to install it! You did it!

So let's try to deploy this time ~

Recommended Posts

A story about trying to install uwsgi on an EC2 instance and failing
A story about trying to run JavaScripthon on Windows and giving up.
A story about trying to use cron on a Raspberry Pi and getting stuck in space
A story I was addicted to trying to install LightFM on Amazon Linux
A story about trying to connect to MySQL using Heroku and giving up
Try running a Schedule to start and stop an instance on AWS Lambda (Python)
[AWS] Install node.js on EC2 instance and execute sample program
A story about trying to implement a private variable in Python.
A story about trying to automate a chot when cooking for yourself
How to install pandas on EC2 (How to deal with MemoryError and PermissionError)
A story about trying to run multiple python versions (Mac edition)
Building an environment to run ChainerMN on a GPU instance on AWS
A story about wanting to think about garbled characters on GAE / P
I got an error when trying to install Xgboost and its solution
[Python] Create a linebot to write a name and age on an image
A story about creating an anonymous channel on Slack from zero knowledge
A story of a deep learning beginner trying to classify guitars on CNN
A story about Python pop and append
A story about a beginner trying hard to set up CentOS 8 (procedure memo)
A story about a 503 error on Heroku open
Build Linux on a Windows environment. Steps to install Laradock and migrate
A story about building an IDE environment with WinPython on an old Windows OS.
[2020 version] How to install Python3 on AWS EC2
A story about operating a GCP instance from Discord
A story about Go's global variables and scope
A story about displaying article-linked ads on Jubatus
A story about running Python on PHP on Heroku
A story about modifying Python and adding functions
A story about an engineer who came only on the server side created a portfolio
How to terminate an AWS EC2 instance (remove security G and delete key pair)
A story that got stuck when trying to upgrade the Python version on GCE
How to build a beautiful Python environment on a new Mac and install Jupter Notebook
A story about how Windows 10 users created an environment to use OpenCV3 with Python 3.5
A story of trial and error trying to create a dynamic user group in Slack
A story about a Python beginner trying to get Google search results using the API
From installing Flask on CentOS to making it a service with Nginx and uWSGI
The story of trying to contribute to COVID-19 analysis with AWS free tier and failing
A story about trying to introduce Linter in the middle of a Python (Flask) project
[AWS EC2] How to install only MySQL client on Amazon Linux 2 and connect to RDS
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
A story of trying out pyenv, virtualenv and virtualenvwrapper
How to install Linux on a 32bit UEFI PC
How to install Git GUI and Gitk on CentOS
A story about trying a (Golang +) Python monorepo with Bazel
A story about kindergartens, nursery schools, and children's gardens
A story about struggling to loop 3 million ID data
How to deploy a Go application to an ECS instance
[AWS EC2] How to install Maven on Amazon Linux 2
How to install git on Linux such as EC2
A story about a Linux beginner putting Linux on a Windows tablet
I tried to install scrapy on Anaconda and couldn't
Good and bad code to compare on a minimap
[Note] A story about trying to override a class method with two underscores in Python 3 series.
[Django] A story about getting stuck in a swamp trying to validate a zip with form [TDD]
A story about porting the code of "Try and understand how Linux works" to Rust
About Class and Instance
Install LAMP on Amazon Linux 2 and build a WordPress environment.
SSH connection to a private server using a bastion server on EC2
A story about how to specify a relative path in python.
A story about installing matplotlib using pip with an error
Install pyenv on MacBook Air and switch python to use