You are here: Download Web>MacPortsMacintoshInstallation (15 May 2010)

Installing Opus/UrbanSim on the Mac using MacPorts

Note: these directions are no longer current or needed! They are left here in case we need to revive using MacPorts at some point.


These following instructions are for installing Opus/UrbanSim on Macintosh OS X. Unfortunately there isn't an installer for the Mac, so you'll need to install the necessary packages separately, in some cases building them from source. The following directions use MacPorts and Python version 2.6. For alternatives to MacPorts, see MacintoshInstallationHints.

Prerequisites

Install the following applications if you don't have them already:
  • XCode. This comes as an optional install on the Leopard Install disks. You should use the version recommended in the XCode section of the MacPorts documentation. To check the version, locate XCode in the Finder under Macintosh HD / Developer / Applications / XCode and select Get Info. If your version is older, download the appropriate version of XCode for your version of Mac OS X. Downloads are linked from the MacPorts Documentation. This is a ~900mb download.
  • MacPorts (note that this is a local wiki page, with a link to the main MacPorts page and some hints)
  • Qt (get the LGPL version) The framework should be sufficient.
  • Optional: MySQL; also MySQL Administrator and MySQL Query Browser. There is more information on installing MySQL on InstallingMySQL.

Installing Python

Install Python using MacPorts:

sudo port install python26 python_select

This will built Python from source, including automatically downloading and installing prerequisite packages. It will take about an hour (longer if gcc needs to be built first, faster if you have a multicore machine and enable multiple build jobs on MacPorts).

Now switch to using MacPorts Python 2.6 (if you are not already using it):

sudo python_select python26

Check to make sure you will be using the correct Python by starting it up -- you should get Python 2.6. And

which python

should say something like

/opt/local/bin/python

Installing Required Python Packages

Install the following required packages for Opus/UrbanSim using MacPorts:
  • py26-numpy
  • py26-scipy
  • py26-lxml
  • py26-matplotlib
  • py26-sqlalchemy
  • py26-pil
  • py26-pyqt4 [this might take a very long time]
  • py26-elixir
Use commands like this: sudo port install py26-numpy py26-scipy

Installing Optional Python Packages

  • If you are using MySQL, install py26-mysql using MacPorts
  • If you are using R, install RPy (not yet tested with MacPorts Python)
  • If you need to use .dbf files (for example, those produced by ArcGIS), install dbfpy (not yet tested with MacPorts Python)

Installing Opus and Urbansim

Follow these directions: DownloadingSampleDataAndSourceCode

Defining Environment Variables

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

  • PYTHONPATH - This environment variable tells Python where to look for files outside of Python's 'site-packages' directory (which is the default location for Python installers). Change PYTHONPATH to include the path to the directory containing the packages opus_core, urbansim, and so forth, that you downloaded in the previous step.
  • OPUS_HOME - The Opus home directory (surprise). This includes subdirectories with sample data for Eugene and Seattle projects, output from runs, template configurations for running simulations using these projects, and probably your source code and documentation. This is the directory you downloaded from the zip file and installed in the previous step. So if you put this unzipped directory just in your home directory, set this variable to /Users/yourname/opus.
Optionally, depending on what you are using and where you store your data, you might want to set this variable as well.
  • OPUS_DATA_PATH (optional) - The directory where you keep your sample data and caches of data for particular runs. It defaults to the data subdirectory under OPUS_HOME, so if you leave the data at the default location from the zip file, don't set this variable.
See MacintoshInstallationHints for information on defining environment variables on the Mac.

Testing Your Installation

To test if your installation was successful, in a shell, navigate to the opus_gui project and type python opus.py. This should start up the GUI. Then do File, Open Project, and select the eugene_gridcell project. In the Scenarios tab of the GUI, select the Eugene_baseline scenario, right-click, and run. Click the start run button and if this completes, you should have a working install.

-- AlanBorning - 17 Aug 2009
Topic revision: r16 - 15 May 2010 - 15:25:41 - AlanBorning
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback