Jay
Jay

Reputation: 341

Error while installing uWSGI on mac

I need uWSGI for running a django project. So when i'm trying to install uWSGI, its giving me an error saying "Exception: you need a C compiler to build uWSGI". But mac comes with gcc compiler.

I've downloaded uWSGI from "http://projects.unbit.it/uwsgi/wiki/WikiStart#Getit" and tried to install by the command "python setup.py install"

This is the error i got while installing uWSGI

running install
using profile: buildconf/default.ini
detected include path: ['/usr/local/include', '/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple
darwin11/4.2.1/include', '/usr/include', '/System/Library/Frameworks', '/Library/Frameworks']
Traceback (most recent call last):
  File "setup.py", line 98, in <module>
    distclass=uWSGIDistribution,
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py",
line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py",
line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py",
line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 61, in run
    conf = uc.uConf(get_profile())
  File "/Users/jay/Downloads/Softwares/Work/uwsgi-1.2.4/uwsgiconfig.py", line 340, in __init__
    raise Exception("you need a C compiler to build uWSGI")
Exception: you need a C compiler to build uWSGI

Upvotes: 28

Views: 18469

Answers (7)

kevincal
kevincal

Reputation: 1

Note for mac's that this could actually be because xcode requires you to accept the license agreement from the command line before it lets you run gcc

Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

Upvotes: 0

Karishma Sukhwani
Karishma Sukhwani

Reputation: 655

Use pip with sudo

sometimes pip packages are not installed or python is not able to create runnable files for virtualenv just because it doesn't have enough permissions. Since it is not showing permission error, it is taking time to resolve it. You can use following command to install it.

sudo python -m pip install uwsgi
or
sudo pip install uwsgi

Upvotes: 0

K.MAZ
K.MAZ

Reputation: 1

Install Xcode in your mac than select command line tool in Xcode preferences. It works for me by doing pip install uwsgi

Upvotes: 0

erncnerky
erncnerky

Reputation: 404

first install gcc compiler

xcode-select --install

Upvotes: 0

Anurag Meena
Anurag Meena

Reputation: 166

Install CommandLine Tools

$xcode-select --install

Then run

$pip install uwsgi

Upvotes: 7

Evin
Evin

Reputation: 321

distutils is probably returning something like "gcc-4.2" instead of plain old "gcc".

With sudo, etc., you probably want to do something like this:

sudo CC=gcc pip install uwsgi

Upvotes: 18

sing1ee
sing1ee

Reputation: 401

gcc already installed, just export CC=gcc will be ok.

Upvotes: 40

Related Questions