Question

When I try to install grequests on Ubuntu with pip:

sudo pip install grequests

I get this error, but my gcc seems fine:

In file included from gevent/core.c:253:0:

gevent/libevent.h:9:19: fatal error: event.h: No such file or directory

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Was it helpful?

Solution

You need to install libevent, which on Ubuntu can be done with:

apt-get install libevent-dev 

Alternatively, to install gevent and all it's dependencies automatically:

apt-get install python-gevent

OTHER TIPS

sudo apt-get install libevent-dev

grequests depends on the Python module gevent, and pip will pull that in for you automatically.

gevent depends on the C library libevent, and there's no way pip can take care of that for you. So, you need to install it manually, e.g., using your distro's package manager.

(Alternatively, gevent 1.0 and later no longer rely on libevent, or any other external dependencies. But, as of 25 Sep 2013, 1.0 isn't out yet…)

I also get the same error. Following commands helped me:

 $ sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev python3-dev

Now try to install grequests again by following command:

  • Python 2

     $ pip install grequests
    
  • Python 3.x

     $ pip3 install grequests
    

If these commands doesn't help, then you can use the following commands:

  • Python 2

     $ sudo apt install python-pip
     $ pip install wheel
    
  • Python 3.x

     $ sudo apt install python3-pip
     $ pip3 install wheel
    

OR

$ sudo apt-get install python3-dev python3-pip python3-venv python3-wheel -y

Now retry to install grequests. Hope the installation will work properly now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top