Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uWSGI installation exception on Amazon Linux EC2 instance

I'm a newbie trying to set a server for my first phone-App on Amazon EC2 with nginx, django, uWSGI and mySQL.

I'm following those tutorials (actually the second is based on the first one):

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html http://www.oliverelliott.org/article/computing/tut_setup_nginx_django/

I'm using a MacbookPro and once in terminal I ssh into the Amazon Linux EC2 instance. When it comes to install uwsgi..troubles arise. I executed:

$ sudo yum install python-pip
$ sudo yum install python-devel
$ sudo pip install uwsgi

First two worked fine, last command thrown an exception:

    Downloading/unpacking uwsgi
  Running setup.py egg_info for package uwsgi
Installing collected packages: uwsgi
  Running setup.py install for uwsgi
    using profile: buildconf/default.ini
    detected include path: ['/usr/include', '/usr/local/include']
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-root/uwsgi/setup.py", line 109, in <module>
        distclass=uWSGIDistribution,
      File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-root/uwsgi/setup.py", line 71, in run
        conf = uc.uConf(get_profile())
      File "uwsgiconfig.py", line 687, in __init__
        raise Exception("you need a C compiler to build uWSGI")
    Exception: you need a C compiler to build uWSGI
    Complete output from command /usr/bin/python26 -c "import setuptools;__file__='/tmp/pip-build-root/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l8npX4-record/install-record.txt --single-version-externally-managed:
    running install

using profile: buildconf/default.ini

detected include path: ['/usr/include', '/usr/local/include']

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip-build-root/uwsgi/setup.py", line 109, in <module>

    distclass=uWSGIDistribution,

  File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands

    self.run_command(cmd)

  File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command

    cmd_obj.run()

  File "/tmp/pip-build-root/uwsgi/setup.py", line 71, in run

    conf = uc.uConf(get_profile())

  File "uwsgiconfig.py", line 687, in __init__

    raise Exception("you need a C compiler to build uWSGI")

Exception: you need a C compiler to build uWSGI

----------------------------------------
Command /usr/bin/python26 -c "import setuptools;__file__='/tmp/pip-build-root/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l8npX4-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/uwsgi
Storing complete log in /root/.pip/pip.log

I've tried two suggestions I read, but doesn't seem to work for me:

$ export CC=gcc && pip install -r requirements.txt 

and

$ sudo CC=gcc pip install uwsgi

Any suggestions? Thanks a lot in advance!!

like image 689
kuro42 Avatar asked Sep 26 '14 19:09

kuro42


2 Answers

I was helped by this link: uWSGI: Installing from a distribution package

I did:

yum groupinstall "Development Tools"
yum install python-devel

and then:

pip install uwsgi

and after that it works.

like image 167
Denis Tolstunov Avatar answered Oct 17 '22 23:10

Denis Tolstunov


This installation helped me:

sudo yum groupinstall "Development Tools"
sudo yum install python3-devel
like image 3
4d61726b Avatar answered Oct 17 '22 22:10

4d61726b