Installing Opus & UrbanSim on Windows

You have two options for installing Opus and UrbanSim on Windows. The first is to use the Windows Opus installer. This option is simpler and is recommended for most users. The second option is to download and install Python and all of the relevant packages manually, as described below.

These following instructions are for installing Opus & UrbanSim on Windows.  These installation directions have been tested with Windows XP and Intel processors.

  1. Install Python
  2. Install Python libraries and Qt
  3. (optional) Install MySQL
  4. Install Opus and UrbanSim
  5. Define Environment Variables for Opus and UrbanSim
  6. Testing your installation

Step 1: Installing Python

Opus and UrbanSim are implemented in Python, making heavy use of numerical Python packages and other software.  Currently, Opus and UrbanSim are known to work on Python 2.5.1.  The official Python website includes documentation, downloads, and much else.

Download and install the Python 2.5.1 Windows installer from http://www.python.org/download/.

Step 2: Installing Python Libraries and Qt

Opus and Urbansim require a number of Python packages, and make optional use of several others. Download and install them from the list of required, recommended and optional Python packages. Many packages have multiple versions. Be sure to pick the ones designed for use with Windows and Python 2.5.1.

(optional) Step 3: Installing MySQL

MySQL is an efficient, open-source SQL database. You don't need it to run the basic Eugene tutorial, although for serious use with your own dataset you will want a database of some sort. Also, currently some of the unit tests use MySQL -- so if you don't install it, not all of the unit tests will pass. (However, we are steadily reducing the dependencies on the particular database used, with the goal of allowing Opus and UrbanSim to be used with any SQL database.) If you use MySQL you can either have a local copy or run on a shared server.

If you don't install MySQL right away, you can return and install it later if you discover you need it.

Opus works with MySQL 4.1 and 5.0.

  1. Choose which version of MySQL to use, and download the Windows installer it from http://dev.mysql.com/downloads/.
  2. Install and configure MySQL via these instructions(Note that the installation and configuration steps are identical for MySQL 4.1 and 5.0.)

MySQL runs as a server. The Windows installer automatically starts this service and configures it to restart whenever you restart your computer. You also may start the service from the Windows Services control panel, or from the command prompt by using the command net start mysql, and stop it using net stop mysql.

In addition to MySQL itself, you might get the MySQL Query Browser (for prowling around in UrbanSim databases using a graphical interface), and the MySQL Administrator. These are both available as binaries.

Step 4: Installing Opus and UrbanSim

Follow the directions on the Downloading the Opus/UrbanSim sample data and source code page.

Those directions use a command-line subversion client. On Windows you can use a graphical client, TortiseSVN, instead. If you don't have it already, download TortiseSVN by following the link.  (You can use another client if you prefer, though -- see http://subversion.tigris.org/project_packages.html for a list.)

You're going to check out the source code into the opus\src directory. You can either get all of the Opus and UrbanSim packages, or just the ones you need.  Getting them all is simpler but only do this if you have a fast internet connection and enough disk space (since there will be a lot of data).

To get them all for latest development release, in Windows explorer, open up the opus\src directory and right-click in an empty region.  Select 'SVN Checkout ...', and fill in the "URL of repository' field in the dialog box with: 'https://trondheim.cs.washington.edu/svn/opus/trunk/' (without the quotes).  The checkout directory should be already filled in with your workspace folder.  Pick 'OK', and your system should download all of the Opus/Urbansim packages.

Alternatively, to get just the packages you need, again in Windows explorer, open up the opus\src directory and right-click in an empty region.  Select 'SVN Checkout ...', and fill in the "URL of repository' field in the dialog box with: 'https://trondheim.cs.washington.edu/svn/opus/trunk/opus_core/'. (without the quotes).  The checkout directory should be already filled in with your workspace folder -- but to this append '\opus_core'.  (So if you used the suggested location for the workspace, the whole name will be 'c:\opus\src\opus_core'.  Pick 'OK', and your system should download the opus_core package.  Do the same thing for the other packages you need, minimally 'urbansim', 'urbansim_gridcell', 'eugene', and 'opus_gui'.  In other words, the repository addresses for these packages are:

In either case, you should end up with a directory structure like this:

c:\opus
    src
        opus_core
        urbansim
        urbansim_gridcell
        eugene
        opus_gui
        ....
Later, you can update a package to the latest version from the repository by right-clicking on its folder and picking 'SVN Update'. You can also select several packages at once by selecting the whole group.

The above commands check out the latest development version of the code -- adjust the URLs appropriately to get a stable release. See Opus Revisions and Releases for details on how to do this.

Step 5: Defining Environment Variables 

UrbanSim requires the following environment variables.  The first tells the Python interpreter where to find the Opus/UrbanSim code. The others tell the system where to find your cached data and configurations.

The following directions illustrate how to set the OPUS_HOME environment variable on Windows:

  1. Open the control panel by going to Start > Control Panel
  2. Double click the icon labeled System. If you can’t see the System icon double click on the link labeled Switch to Classic View under the menu labeled Control Panel on the left pane, and then double click on the icon labeled System. 
  3. Choose the Advanced tab, and press the button at the bottom of the panel labeled Environment Variables
  4. Add or edit the variable called OPUS_HOME in the list labeled User Variables. (But see below for more on User Variables vs. System Variables.) 
  5. Select OK to create the variable. 

User variables versus System variables.  Environment variables on Windows come in two flavors: user variables and system variables.  (There are two separate sections in the “Environment Variables” control panel, one for User Variables and the other for System Variables.)  User variables apply only to the current user login; system variables apply to all logins on that machine.  If there is a variable of the same name in both, the user variable overrides the system variable. 

So, for the Opus environment variables, if you are running on a personal machine, it doesn’t matter whether you employ a user variable or a system variable.  If you are running on a shared machine, and are installing a personal copy of Opus, employ a user variable; that way others can have their own copy of Opus and you won’t interfere with each other. And if you are running on a shared machine and are setting up an installation for lots of users of the machine, employ a system variable.

One final wrinkle: the installer for some Python-based tools will add a directory to the PYTHONPATH system variable.  If you also have a user variable named PYTHONPATH, this will override the system variable — so copy the information from the system variable, add your own directory to it, and define the PYTHONPATH user variable.  And of course, if you have already installed Opus and later install some other Python-based tool that does this, you may need to edit your user variable appropriately.

Step 6: Testing your installation

Follow these instructions to test your installation.