Skip to content

Windows installation instructions

Clint Daniels edited this page Apr 11, 2016 · 13 revisions

Installation Instructions for sandag_urbansim Model

This document lists the Windows installation steps for the proof-of-concept Subregional Allocation Model. The code for this project lives on github at https://github.com/synthicity/sandag_urbansim. The input data can be downloaded from the SANDAG OneDrive directory.

Suggested computer requirements The model runs best on a computer with a 64-bit operating system and at least 16GB of RAM.

Steps

1. Download and install Git

a.	    https://git-scm.com/downloads

2. Download and install 64-bit Python 2.7 Anaconda installer

a.	    https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.2.0-Windows-x86_64.exe

b.	    Other versions available at:  https://store.continuum.io/cshop/anaconda/

3. Download and install Postgres

a.	    http://get.enterprisedb.com/postgresql/postgresql-9.4.2-1-windows-x64.exe

b.	    After installation, use postgres' "Application Stack Builder" to install PostGIS

c.	    Add C:\Program Files\PostgreSQL\9.4\bin to your PATH environmental variable if not already there (edit this if different postgres version used)

4. Install additional Python dependencies

a.	    From command prompt type:

    i.	conda install gdal

    ii.	conda install sqlalchemy=0.9.9

    iii.	pip install pandana GeoAlchemy2

b.	    Download wheel for psycopg2

    i.	Browse to http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg

    ii.	Download a wheel for 64-bit python 2.7 (e.g. psycopg2-2.5.5-cp27-none-win_amd64.whl)

    iii.	From command prompt type, navigate to directory containing downloaded wheel, then type  “pip install psycopg2-2.5.5-cp27-none-win_amd64.whl” to install the downloaded python wheel

5. Install UrbanSim. From command prompt type:

a.	    git clone https://github.com/sandag/urbansim -b sandag

b.	    cd urbansim

c.	    python setup.py develop

6. Install urbansim_defaults. From command prompt type:

a.	    git clone https://github.com/sandag/urbansim_defaults

b.	    cd urbansim_defaults

c.	    git reset --hard 993ac4d20f3c2b7b2b8b38844045a36b1adb1758

d.	    python setup.py develop

7. Install spandex. From command prompt type:

a.	    git clone https://github.com/synthicity/spandex

b.	    cd spandex

c.	    python setup.py develop

8. Get code for the sandag_urbansim project

a.	    git clone https://github.com/synthicity/sandag_urbansim

9. In your home directory (e.g. on windows C:/users/username), create a ".spandex" directory and in this directory create a text file named "user.cfg".

a.	    Populate text file with postgres database settings.  

b.	     E.g.: see sample at bottom of this wiki page

10. If the postgres database specified in the config file doesn't already exist, create it (e.g. use PgAdmin).

11. If the input data directory specified in the config file doesn't already exist, create it and populate with the contents of OneDrive.

a.	    In this data directory, also create an 'out' folder-  this is where the data regeneration script output (e.g. the hdf5 file) will go.

12. If not using an existing sandag.h5 HDF5 file, generate it

a.	    python /sandag_urbansim/scripts/run.py

b.	    If successfully runs, you will see a sandag.h5 exported to the ‘out’ folder within your data directory (i.e. the OneDrive directory that your spandex configuration file points to)

13. Run a simulation out to 2040

a.	    In the /sandag_urbansim/data directory, in addition to the hdf5 file, you will also need the files/folders contained in:

    i.	https://dl.dropboxusercontent.com/u/69619688/for_data_dir_sandag_05282015.zip

    ii.	Unzip the contents of the above zip file and place in /sandag_urbansim/data alongside sandag.h5 hdf5 file.

b.	    Run the Simulation notebook

    i.	cd /sandag_urbansim/notebooks

    ii.	ipython notebook

    iii.	Open Simulation notebook, execute desired cells

14. Run calibration

a.	    Ensure /sandag_urbansim/data directory is populated per the previous step

b.	    Run the Calibration notebook

    i.	cd /sandag_urbansim/notebooks

    ii.	ipython notebook

    iii.	Open Calibration notebook, edit settings as desired, execute cells

15. If planning to export data to the Urban Canvas database from this machine, configure pgpass.conf (credentials for exporting to the database)

a.	    Pgpass.conf is typically located in:  C:\Users\username\AppData\Roaming\postgresql

b.	    Open in text editor, and add a line that says:

    i.	urbancanvas.cp2xwchuariu.us-west-2.rds.amazonaws.com:*:sandag:parcel22building

Sample config file (user.cfg)

[database]

database = sandag

user = postgres

password = postgres

host = localhost

port = 5432

[data]

directory = C:\\sandag\\data

srid = 2230

Clone this wiki locally