Celery keeps throwing an error when I run my workers with --pool gevent or eventlet but works fine without these pools specified [duplicate]

I have a celery task like so:

from celery import Celery
from asgiref.sync import async_to_sync
from celery_app.celery_commands import some_async_command
import os

redis_connection_string = os.environ.get("REDIS_URL")
celery_app = Celery(
    'tasks', backend=f"{redis_connection_string}/0", broker=f"{redis_connection_string}/1")

@celery_app.task()
def sample_task(**kwargs):
    result = async_to_sync(some_async_command)(**kwargs)
    return result

When I use run celery for this task with : celery -A celery_app.tasks worker --loglevel=INFO -n my_app_worker --concurrency=4, it works fine. However, since the async function some_async_command is mainly I/O-bound and makes calls to the network, I was considering using gevent pool. I have installed gevent, but when I run celery -A celery_app.tasks worker --loglevel=INFO -n my_app_worker --concurrency=4 --pool gevent, it throws the error:

Usage: celery [OPTIONS] COMMAND [ARGS]...
Try 'celery --help' for help.

Error: Invalid value for '-A' / '--app': 
Unable to load celery application.
Module 'select' has no attribute 'epoll'

What am I missing?

Back to Top