Eventlet was deprecated for 26.0 and is now removed: - Delete gunicorn/workers/geventlet.py and its registry entry - Drop eventlet from config help text, HTTP/2 unsupported-worker messages, and the dirty client docstring - Drop the eventlet optional-dependency, the eventlet entry in the testing extra, and the eventlet-only filterwarnings ignore - Drop the EventletWorkerAlpn test class - Drop the freebsd CI ignore for the (now non-existent) test_geventlet.py - Drop eventlet from the issue-triage discussion template - Drop eventlet from README, install/design/http2/settings/news docs; rewrite the news.md entry from 'deprecated' to 'removed in this release' Add h2 and uvloop to requirements_test.txt so a plain 'pip install -r requirements_test.txt' run reaches feature parity with 'pip install .[testing]' for those two deps. The container suite previously skipped 87 HTTP/2 tests for missing h2 and 1 for uvloop; the in-process suite skips drop from 67 to 40.
3.2 KiB
Installation
!!! note Gunicorn requires Python 3.12 or newer.
Quick Install
=== "pip"
```bash
pip install gunicorn
```
=== "pipx"
```bash
pipx install gunicorn
```
=== "Docker"
```bash
docker pull ghcr.io/benoitc/gunicorn:latest
docker run -p 8000:8000 -v $(pwd):/app ghcr.io/benoitc/gunicorn app:app
```
See the [Docker guide](guides/docker.md) for production configurations.
=== "System Packages"
**Debian/Ubuntu:**
```bash
sudo apt-get update
sudo apt-get install gunicorn
```
**Fedora:**
```bash
sudo dnf install python3-gunicorn
```
**Arch Linux:**
```bash
sudo pacman -S gunicorn
```
!!! warning
System packages may lag behind the latest release. For production,
prefer pip installation in a virtual environment.
Virtual Environment (Recommended)
Always install Gunicorn inside a virtual environment to isolate dependencies:
# Create virtual environment
python -m venv venv
# Activate it
source venv/bin/activate # Linux/macOS
# or: venv\Scripts\activate # Windows
# Install gunicorn
pip install gunicorn
From Source
Install the latest development version from GitHub:
pip install git+https://github.com/benoitc/gunicorn.git
Upgrade to the latest commit:
pip install -U git+https://github.com/benoitc/gunicorn.git
Extra Packages
Gunicorn provides optional extras for additional worker types and features. Install them with pip's bracket syntax:
pip install gunicorn[gevent,setproctitle]
Worker Types
| Extra | Description |
|---|---|
gunicorn[gevent] |
Gevent-based greenlet workers |
gunicorn[gthread] |
Threaded workers |
gunicorn[tornado] |
Tornado-based workers (not recommended) |
See the design docs for guidance on choosing worker types.
Utilities
| Extra | Description |
|---|---|
gunicorn[setproctitle] |
Set process name in ps/top output |
!!! tip
If running multiple Gunicorn instances, use setproctitle with the
proc_name setting to distinguish them.
Async Workers
For applications using async I/O patterns, install the appropriate greenlet library:
=== "Gevent"
```bash
pip install gunicorn[gevent]
```
Run with:
```bash
gunicorn app:app --worker-class gevent
```
=== "ASGI (asyncio)"
No extra installation required:
```bash
gunicorn app:app --worker-class asgi
```
For better performance, install uvloop:
```bash
pip install uvloop
gunicorn app:app --worker-class asgi --asgi-loop uvloop
```
!!! note
Greenlet-based workers require the Python development headers. On Ubuntu:
sudo apt-get install python3-dev
Verify Installation
Check the installed version:
gunicorn --version
Test with a simple application:
echo 'def app(e, s): s("200 OK", []); return [b"OK"]' > test_app.py
gunicorn test_app:app
# Visit http://127.0.0.1:8000
Next Steps
- Quickstart - Get running in 5 minutes
- Run - CLI usage and framework integration
- Configure - Configuration options