Setup Locust (Python/load testing) on Windows

I recently used Locust, a load testing tool that lets you write intuitive looking Python code to load test your web applications. I did not follow Locust’s install guide and instead just tried a ‘pip install locustio’. I ended up running into some issues that were not easy to Google about. So I thought I would document the problems I faced along with there solution over here.

Getting setup with Locust on Windows

If you have not already tried installing Locust, follow this short and handy guide. It will help you avoid the problems I faced.

1. Use Python 2.7.x where x >=4. I upgraded my Python to 2.7.11.
2. pip install pyzmq
3. pip install locustio
4. Test your installation by opening up a command prompt and typing locust.--help You should see no errors or warning – only the usage and help should be printed out on your console.

Locust install issues and solutions

When I installed Locust for the first time, I missed steps 1 and 2 in the section above. So I ran into a couple of errors.

1. ImportError: DLL load failed

from gevent.hub import get_hub, iwait, wait, PYPY
File “c:\python27\lib\site-packages\gevent\”, line 11, in
from greenlet import greenlet, getcurrent, GreenletExit
ImportError: DLL load failed: The specified procedure could not be found.

I got this error because I had Python 2.7.2 (python –version) and Locust needs at least Python 2.7.4. To solve this issue, upgrade your Python version. I ended up installing Python 2.7.11.

2. UserWarning: WARNING: Using pure Python socket RPC implementation instead of zmq

c:\python27\lib\site-packages\locust\ UserWarning: WARNING: Using pure Python socket RPC implementation instead of zmq.

I got this warning when running the command ‘locust –help’ to test my setup. The warning comes with a helpful recommendation to install pyzmq. I installed pyzmq (pip install pyzmq) and the error went away.

3. pip install locustio gives error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).

I got the below error when install locust using pip install locustio

building ‘gevent.corecext’ extension
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).

I tried installing “gevent” alone using pip install gevent, but got the same error

After bit of searching i installed “gevent” from unofficial windows Binaries for Python Extension Packages.
Download the whl file as per your os combination. I downloaded gevent-1.1.1-cp27-cp27m-win32.whl file.
open command prompt in the directory where you have downloaded whl file and run the below command.

python -m pip install gevent-1.1.1-cp27-cp27m-win32.whl

After that i was able to install locust successfully.

My thoughts on Locust as of May, 2016

A random collection of my thoughts having explored Locust for a little bit.

1. This tool is worth exploring deeper. This is the first load testing tool that I found intuitive.
2. Locust lets me reuse the API checks that I anyway write as part of testing a web application
3. I liked Locust’s documentation. I found the documentation very, ummm, Pythonic! Clearly they have put in effort into making the documentation useful.
4. I got a useful, working prototype for a real world problem in less than a weekend
5. I don’t know how powerful their http client (the one you use to make requests) is … so we may trip up at login for some clients.
6. I hated the way they do not have an automatic ‘end’ to any test – but that is a minor complaint
7. With respect to the resources (memory, CPU) on the client machine, locust swarms scale so much better than Qxf2’s map-reduce solution (think 25:1)
8. There is a limit of 1024 locusts per swarm that maps to the maximum number of files that can be open on Windows. But their documentation warns you about this beforehand. You can increase this number, if needed, on your OS.
9. Their reporting is not persistent or stored

Qxf2 will be exploring this tool over the coming months. I want to try more complex login scenarios, nested tasks and distributed swarms.

29 thoughts on “Setup Locust (Python/load testing) on Windows

  1. I just confrmed my system type is x64. I believe that everything that I installed was donwloaded as x64. I can’t understand why I’m receiving this error.
    C:\Users\jovan\Downloads>python -m pip install gevent-1.5a2-cp38-cp38-win_amd64.whl
    ERROR: gevent-1.5a2-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.

    1. Jovan,

      Can you try installing the previous version of gevent and see if you are able to install?
      gevent‑1.4.0‑cp37‑cp37m‑win_amd64.whl Or you can also try below steps:

      1. Create a new python 3 environment and activate it
      2. Download the latest binary for gevent from the unofficial windows Binaries.
      3. python -m pip install gevent-1.5a2-cp38-cp38-win_amd64.whl

      Hope this helps !

      1. but doing this… what python version will I be working with?
        right now, I’m able to work with Pythin 7 and locust 0.14.5
        but I can feel locust is not working fine to me.
        I think that locust executes auto-update to this latest version, when installed…

        I don’t think that installing Python 3, will work better than it’s working now to me.

      2. Hi, Can you try using a Virtual Environment and specifically try with Python 3 (its been tested and worked with that). Also, you try pip install locust==0.14.5 to install a selected version.

  2. ‘locust’ is not recognized as an internal or external command,
    operable program or batch file.

    I tried every possible solution but still this only showing
    Anyone please help

    1. Hello,
      I tried on Ubuntu by Creating Virtual Environment and installed pip install locust in that VENV
      have taken sample example from and ran locust -f and able to run without any issues.

      can you please elaborate what exactly you are doing so that it may useful to dig further.


Leave a Reply

Your email address will not be published. Required fields are marked *