error: command 'gcc' failed with exit status 1 while installing eventlet

Solution 1:

Your install is failing because you don't have the python development headers installed. You can do this through apt on ubuntu/debian with:

sudo apt-get install python-dev 

for python3 use:

sudo apt-get install python3-dev

For eventlet you might also need the libevent libraries installed so if you get an error talking about that you can install libevent with:

sudo apt-get install libevent-dev

Solution 2:

For Fedora:

sudo yum install python-devel

sudo yum install libevent-devel

and finally:

sudo easy_install gevent

Solution 3:

What worked for me on CentOS was:

sudo yum -y install gcc
sudo yum install python-devel

Solution 4:

For Redhat Versions(Centos 7) Use the below command to install Python Development Package

Python 2.7

sudo yum install python-dev

Python 3.4

sudo yum install python34-devel

Python 3.6

sudo yum install python36-devel

If the issue is still not resolved then try installing the below packages -

sudo yum install python-devel

sudo yum install openssl-devel

sudo yum install libffi-devel

Solution 5:

On MacOS I had trouble installing fbprophet which requires pystan which requires gcc to compile. I would consistently get the same error: command 'gcc' failed with exit status 1

I think I fixed the problem for myself thus:

I used brew install gcc to install the newest version, which ended up being gcc-8

Then I made sure that when gcc ran it would use gcc-8 instead.

It either worked because I added alias gcc='gcc-8 in my .zshrc (same as .bashrc but for zsh), or because I ran export PATH=/usr/local/bin:$PATH (see comment)

Also: all my attempts were inside a virtual environment and I only succeeded by installing fbprophet globally (with pip), but still no success inside a venv