Introduction to the SimPy Discrete-Event Simulation Package

Professor Norm Matloff
University of California, Davis


About SimPy:

SimPy (rhymes with "Blimpie") is a public-domain package for process-oriented discrete-event simulation, developed originally by Klaus Muller and Tony Vignaux. It is written in, and called from, Python. I like the clean manner in which SimPy is designed, its use of Python generators, and for that matter, Python itself.

You may also wish to try a new SimPy offshoot, salabim.

If you haven't used Python before, you can learn enough about it to use SimPy quite quickly; see my quick tutorial on Python. The first chapter should suffice.


This site is devoted to provided quick access to SimPy 2.1-3. Version 3.0 brought a major redesign, unfortunately not backward-compatible.

Where to obtain it:

Download it from this archive .


Install the SimPy module. If you are not familiar with Python modules, first see the installation instructions below.

Then from a directory from which SimPy/ is an immediate subdirectory, copy the M/M/1 queue example to the current directory and run


The long-run wait will print out, about 1.0.

How to install it:

Create a directory, say /usr/local/SimPy. You need to at least put the code files Simulation.* and __init__.* in that directory, and I will assume here that you also put in the test and documentation subdirectories which come with the package, say as subdirectories of /usr/local/SimPy.

You'll need that directory to be in your Python path, which is controlled by the PYTHONPATH environment variable. Set this in whatever manner your OS/shell set environment variable. For example, in csh on Linux or a Mac, type

setenv PYTHONPATH /usr/local/

Modify accordingly for bash, Windows, etc.

One way or the other, you need to be set up so that Python finds the library files correctly. Both the SimPy example programs and our example programs here include the line

from SimPy.Simulation import *

which instructs the Python interpreter to look for the module Simulation in the package SimPy. Given the setting of PYTHONPATH above, Python would look in /usr/local/ for a directory SimPy, i.e. look for a directory /usr/local/SimPy, and then look for and (or their .pyc compiled versions) within that directory.

Test by copying testSimPy to some other directory and then running


A message like "Run 84 tests..." will appear.

More information:

SimPy comes with quite a bit of documentation, including a number of examples.

Links to my SimPy tutorial:

I have a SimPy tutorial embedded in my online course on discrete-event simulation. The course is in the PDF files in, with the first unit of the SimPy tutorial being in the file See the above directory of PDF files for the remainder of the tutorial.

The .tex source files are in that directory too. To run the example programs yourself, just download the .tex file and edit to the example program code.