ImportError: cannot import name 'Command' from 'celery.bin.base'

Had same issue while working on celery 5.0.5 so switched to celery 4.4.7 version with flower 0.9.7 and it worked.


One workaround, if you prefer to avoid downgrading your Celery worker, is to run a previous version of Flower separate from your main Celery install. For example, in a container or separate venv. Flower just monitors your broker, and can be run completely separate from your Celery worker.

Flower in Docker example

For your Django/Celery install, run Celery normally (no Flower):

celery -A main worker

For Flower, use docker image mher/flower:0.9.5, which internally uses Celery 4.4.6, and is reported working.

Here is a sample docker run command:

docker run --name flower -p 5555:5555 mher/flower:0.9.5 flower --broker=redis://redis-address

Note: You must change the broker address to be your broker's dns-resolvable name or ip. For rabbitmq, use --broker=amqp://guest@rabbitmq-address:5672//. See the url documentation for advanced options.

Once running, Flower should be available at the Docker host's IP:5555

You can alternatively create a docker-compose file encapsulating all of the arguments in the run command, and use docker-compose up -d.

Alternatives

If preferred, you can also do all this without Docker, using pip install flower redis celery==4.4.7, as long as it is separate from your main Celery install, and then run flower with flower --broker=redis://redis-address. A separate venv may work for this.

See the github issue for future updates on the original bug.


Flower is always lagging behind Celery, so if you use the latest Celery (they refactored the CLI) it will probably fail. Stick to 4.4.x until Flower catches up.