Celery Setup for Windows

Over the past few months I’ve been falling for Ubuntu’s terminal. Windows installations look very daunting, but since I’m married to Windows for the forseeable future I’ll be continuing with Celery installation for Windows (duh!).

Celery installation


Step 1: Get a Broker!

What Celery needs is a broker, to deal with all the incoming messages. One that would be the bouncer on a cold, night in Koregaon Park pub. We’ll go with RabbitMQ (coz that’s what the official Celery page endorses).

Download the RabbitMQ Windows binary. Once, done run the .exe file.

There’s a surprise for you if you don’t have Erlang (oops!). So now you are routed to the Erlang website to download Erlang.

Step 0: Er…lang?

Go to the website (or you would be routed to this page).

Download the OTP 19.2 Windows 64-bit Binary File (101891457) (or whichever is your system architecture).

Run the .exe file and start over with Step 1.

Note: Microsoft Visual C++ would pop-up (annoying MS Builds), if you don’t have the required things for Erlang installation. Be Patient! And (annoyingly) it would tell you to restart. Restart your system for the setup to take effect. How I miss source .bashrc

There’s lot of configurations we could do to customize our RabbitMQ Server, but that’s for another day. Check this page for the same.

Step 2: Where the Server @?

Unlike Ubuntu, where the server starts off after your do $ sudo apt-get install rabbitmq-server, we have to do a bit of click-click to get things up and running. Windows does provide a background process (when initialized, see below).

Task Manager

But to get a shiny web app interface, we do have to turn on the management plugin (Source). Follow the steps to install it:

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.6\sbin>rabbitmq-server restart

          RabbitMQ 3.6.6. Copyright (C) 2007-2016 Pivotal Software, Inc.
##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
##  ##
##########  Logs: C:/Users/prato_s/AppData/Roaming/RabbitMQ/log/RABBIT~1.LOG
######  ##        C:/Users/prato_s/AppData/Roaming/RabbitMQ/log/RABBIT~2.LOG
          Starting broker...
completed with 6 plugins.

__Note:__ Keep the above service running, I had to keep it running at the backend on command prompt. Do not close it.
C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.6\sbin>rabbitmq-plugins enable rabbitmq_management
Plugin configuration unchanged.

Applying plugin configuration to rabbit@DESKTOP-R0SMU94... nothing to do.

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.6\sbin>rabbitmqctl status
broker_url = 'amqp://guest:guest@localhost:15672//'

Step 3: Celery install (Actual)

After all the above things we need to install Celery for Python. Now go to the virtual environment/create one using conda create --name <environment-name> python=<version:2.7/3.5> where you want to install Celery.

(venv) C:\Users\user1>python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from celery import Celery

That was all for the Celery installation. Would keep posted on How to create a Celery Application?

Sources & Reading:

  1. RabbitMQ for beginners - What is RabbitMQ?
  2. Official RabbitMQ
  3. RabbitMQ Ubuntu 16.04 Installation EDIT @14/01/2017
  4. How to install RabbitMQ for MacOS