title: pip install faling with error gevent failed with error code 1 in /private/tmp/pip-build-muEt66/gevent/
body: <p>I have a virtualenv. Inside the virtualenv i want to install some dependencies from a file. My command being </p>
  
  <pre><code>pip intsall -r requirements.txt
  </code></pre>
  
  <p>I am attaching the terminal error output here. First it downloads all the packages in the requirement but it fails later with the attached message.I suspect something wrong with gevent. Please help me as to what is wrong here and how can it be fixed.</p>
  
  <pre><code>    Collecting backports.ssl-match-hostname (from tornado==4.2.0-&gt;flower==0.9.1-&gt;-r requirements/requirements.txt (line 60))
  Installing collected packages: greenlet, gevent, importlib, MySQL-python, ordereddict, Pillow, psycopg2, pycrypto, PyJWT, simplejson, pymediainfo, python-ldap, requests, thrift, unicodecsv, django-crispy-forms, jdcal, openpyxl, python-mimeparse, six, python-dateutil, django-tastypie, retrying, vertica-python, python-memcached, statsd, django-statsd-mozilla, sqlparse, django-debug-toolbar, logilab-common, astroid, coverage, django-coverage, pylint, django-jenkins, gnureadline, ipython, ipdb, mock, pep8, pyflakes, django-debug-panel, gunicorn, pystache, requests-toolbelt, tlslite, oauthlib, requests-oauthlib, jira, PyYAML, simplemail, simple-salesforce, babel, certifi, backports.ssl-match-hostname, tornado, futures, flower, inmobi-ci-fraud, inmobi-ci-adtemplate, inmobi-ci-arbitrage, inmobi-ci-advertiser, inmobi-ci-bms, inmobi-ci-budget, inmobi-ci, inmobi-ci-bulkuploadmodel, inmobi-ci-commonservices, inmobi-ci-configservice, inmobi-ci-dcp, inmobi-ci-geoservice, inmobi-ci-gpm, inmobi-ci-iam, inmobi-ci-impressionlookup, inmobi-ci-iptargeting, inmobi-ci-metadata, inmobi-ci-platform, inmobi-ci-pricingmodel, inmobi-ci-promocode, inmobi-siteclassification, inmobi-uac, inmobi-ccidmetadata-platform, inmobi-ci-publisher, inmobi-ci-rbac-auth, inmobi-ci-rbac-prov, inmobi-offline, inmobi-planet-dcp, cosmos-inmobi-cbp-service, cosmos-inmobi-iam, audience-segment, cosmos-inmobi-segmentmanager, inmobi-asm, inmobi-ci-demand, site-inclusion-exclusion, com-inmobi-planet-app-concept, app-concept-service, inmobi-ci-trackingpartner, com-inmobi-geo-thrift-lis, inmobi-supply-template-platform, inmobi-ci-iam-auth, inmobi-planet-reseller, inmobi-demand-core-rpc
    Found existing installation: greenlet 0.4.13
      Uninstalling greenlet-0.4.13:
        Successfully uninstalled greenlet-0.4.13
    Found existing installation: gevent 1.2.2
      Uninstalling gevent-1.2.2:
        Successfully uninstalled gevent-1.2.2
    Running setup.py install for gevent ... error
      Complete output from command /Users/sourav.prem/cosmos/cosmosenv/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-muEt66/gevent/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-zjChux-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sourav.prem/cosmos/cosmosenv/include/site/python2.7/gevent:
      running install
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.12-intel-2.7
      creating build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/__init__.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/backdoor.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/baseserver.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/coros.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/dns.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/event.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/greenlet.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/http.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/httplib.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/hub.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/local.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/monkey.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/pool.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/pywsgi.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/queue.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/rawgreenlet.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/select.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/server.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/socket.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/ssl.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/sslold.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/thread.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/timeout.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/util.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/win32util.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      copying gevent/wsgi.py -&gt; build/lib.macosx-10.12-intel-2.7/gevent
      running build_ext
      building 'gevent.core' extension
      creating build/temp.macosx-10.12-intel-2.7
      creating build/temp.macosx-10.12-intel-2.7/gevent
      cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/core.c -o build/temp.macosx-10.12-intel-2.7/gevent/core.o
      gevent/core.c:2750:47: error: no member named 'ev_flags' in 'struct event'
        __pyx_t_1 = PyInt_FromLong(__pyx_v_self-&gt;ev.ev_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                                   ~~~~~~~~~~~~~~~~ ^
      gevent/core.c:2830:36: error: no member named 'ev_flags' in 'struct event'
        __pyx_v_flags = __pyx_v_self-&gt;ev.ev_flags;
                        ~~~~~~~~~~~~~~~~ ^
      gevent/core.c:6525:34: error: use of undeclared identifier '_EVENT_VERSION'
        __pyx_t_1 = PyBytes_FromString(_EVENT_VERSION); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
                                       ^
      gevent/core.c:8047:15: warning: implicit declaration of function 'EVBUFFER_LENGTH' is invalid in C99 [-Wimplicit-function-declaration]
          __pyx_r = evbuffer_get_length(__pyx_v_self-&gt;__pyx___obj);
                    ^
      gevent/libevent.h:43:29: note: expanded from macro 'evbuffer_get_length'
      #define evbuffer_get_length EVBUFFER_LENGTH
                                  ^
      /usr/local/include/event2/buffer_compat.h:110:28: note: expanded from macro 'EVBUFFER_LENGTH'
      #define EVBUFFER_LENGTH(x)      evbuffer_get_length(x)
                                      ^
      gevent/libevent.h:43:29: note: expanded from macro 'evbuffer_get_length'
      #define evbuffer_get_length EVBUFFER_LENGTH
                                  ^
      gevent/core.c:8047:15: warning: this function declaration is not a prototype [-Wstrict-prototypes]
      gevent/libevent.h:43:29: note: expanded from macro 'evbuffer_get_length'
      #define evbuffer_get_length EVBUFFER_LENGTH
                                  ^
      /usr/local/include/event2/buffer_compat.h:110:28: note: expanded from macro 'EVBUFFER_LENGTH'
      #define EVBUFFER_LENGTH(x)      evbuffer_get_length(x)
                                      ^
      gevent/libevent.h:43:29: note: expanded from macro 'evbuffer_get_length'
      #define evbuffer_get_length EVBUFFER_LENGTH
                                  ^
      2 warnings and 3 errors generated.
      error: command 'cc' failed with exit status 1
  
      ----------------------------------------
    Rolling back uninstall of gevent
  Command "/Users/sourav.prem/cosmos/cosmosenv/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-muEt66/gevent/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-zjChux-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sourav.prem/cosmos/cosmosenv/include/site/python2.7/gevent" failed with error code 1 in /private/tmp/pip-build-muEt66/gevent/
  </code></pre>