Coroutine-based network library
- Fast event loop based on libev or libuv.
- Lightweight execution units based on greenlets.
- API that re-uses concepts from the Python standard library (for examples there are events and queues).
- Cooperative sockets with SSL support
- Cooperative DNS queries performed through a threadpool, dnspython, or c-ares.
- Monkey patching utility to get 3rd party modules to become cooperative
- TCP/UDP/HTTP servers
- Subprocess support (through gevent.subprocess)
- Thread pools
gevent is inspired by eventlet but features a more consistent API, simpler implementation and better performance. Read why others use gevent and check out the list of the open source projects based on gevent.
gevent was written by Denis Bilenko.
See what’s new in the latest major release.
Check out the detailed changelog for this version.
Read the documentation online at http://www.gevent.org.
Installation and Requirements
gevent 1.5 runs on Python 2.7.9 and up, and Python 3.5, 3.6 and 3.7. gevent requires the greenlet library and will install the cffi library by default on Windows. The cffi library will become the default on all platforms in a future release of gevent.
gevent 1.5 also runs on PyPy 7.0 or above. On PyPy, there are no external dependencies.
gevent is tested on Windows, macOS, and Linux, and should run on most other Unix-like operating systems (e.g., FreeBSD, Solaris, etc.)
On Windows using the deprecated libev backend, gevent is limited to a maximum of 1024 open sockets due to limitations in libev. This limitation should not exist with the default libuv backend.
Older Versions of Python
Users of older versions of Python 2 or Python 3 may install an older version of gevent. Note that these versions are generally not supported.
|Python Version||Gevent Version|
|3.4.0 - 3.4.2||1.3.x|
This section is about installing released versions of gevent as distributed on the Python Package Index. For developing with gevent, including running tests, see development. For building gevent from source, including customizing the build and embedded libraries, see Installing From Source.
On Windows, macOS, and Linux, both gevent and greenlet are distributed as binary wheels.
You need Pip 8.0 or later, or buildout 2.10.0 to install the binary wheels on Windows or macOS. On Linux, you’ll need pip 19 to install the manylinux2010 wheels.
Installing From Source
If you are unable to use the binary wheels (for platforms where no pre-built wheels are available or if wheel installation is disabled), you can build gevent from source. A normal pip install will fall back to doing this if no binary wheel is available. See Installing From Source for more, including common installation issues.
gevent has no runtime dependencies outside the standard library, greenlet, and (on some platforms) cffi. However, there are a number of additional libraries that extend gevent’s functionality and will be used if they are available. All of these may be installed using setuptools extras, as named below, e.g., pip install gevent[events].
- Configurable event support using zope.event is highly recommended for configurable event support.
- Enables the new pure-Python resolver, backed by dnspython. On Python 2, this also includes idna. They can be installed with the dnspython extra.
- Enhancements to gevent’s self-monitoring capabilities. This includes the psutil library which is needed to monitor memory usage. (Note that this may not build on all platforms.)
- A shortcut for installing suggested extras together.
- Everything needed to run the complete gevent test suite.
For development information, including installing from git and running tests, see development.
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.