greenlet is a Python package that provides lightweight in-process concurrent programming through micro-threads called 'greenlets'. The current version is 3.3.2, released on February 20, 2026. The library has a stable release cadence, with updates addressing compatibility and performance improvements.
pip install greenletVerified import paths — ran on the pinned version, not inferred.
This example demonstrates creating and switching between two greenlets. 'gr1' starts 'test1', which switches to 'gr2' running 'test2', and then switches back to 'gr1'.
Upgrade your Python environment to version 3.10 or later.
Upgrade your Python environment to version 3.9 or later.
Ensure that signal handlers return control to the main greenlet without switching.
Avoid calling non-reentrant native functions from multiple greenlets.
Ensure that greenlet switching occurs within the same thread.
Implement appropriate exception handling to manage 'GreenletExit' during garbage collection.
Ensure that all greenlet operations, especially calls to `greenlet.switch()`, occur within the same operating system thread where the greenlet was originally created. If using frameworks like Gevent or Eventlet, ensure that `monkey.patch_all()` is called at the very beginning of your application's execution, before any other threads are spawned or blocking I/O operations are initiated, to properly 'greenify' the standard library. Avoid passing active greenlet instances directly between Python threads.
First, try reinstalling `greenlet` with `pip install greenlet --no-cache-dir` to ensure a fresh download and installation. Ensure your `pip` and `setuptools` are up-to-date (`python -m pip install --upgrade pip setuptools`). If you are on Windows, ensure the appropriate Visual C++ Redistributable packages are installed for your Python version. If issues persist, consider installing `greenlet` by compiling from source using `pip install greenlet --no-binary :all:` after confirming that you have the necessary build tools (like a C compiler) installed on your system.
Install the required build tools for your operating system: for Debian/Ubuntu, `sudo apt-get install build-essential python3-dev`; for macOS, install Xcode Command Line Tools (`xcode-select --install`); for Windows, install Visual C++ Build Tools from Microsoft. Ensure `pip` and `setuptools` are updated (`python -m pip install --upgrade pip setuptools`). If a specific (potentially older) version of `greenlet` is being requested by another package and causes this error, try to update the dependent package or explicitly install a compatible `greenlet` version.
No dependency data recorded yet.