Pandana depends on a number of libraries from the scientific Python stack. The easiest way to get these is to use the Anaconda python distribution, and the instructions below will assume you are using Anaconda.
Pandana depends on the following libraries, most of which are in Anaconda:
- brewer2mpl >= 1.4
- matplotlib >= 1.3.1
- numpy >= 1.8.0
- pandas >= 0.13.1
- tables >= 3.1.0
- osmnet >= 0.1.0
Note
Installing via conda or pip on a Mac will install Pandana without multithreading support. See instructions below for installing on a Mac with multithreading support.
Pandana and some of its dependencies are hosted on UrbanSim Inc's Anaconda repository. To add this as a default installation channel for conda run this code in a terminal:
conda config --add channels synthicity
Then you can install pandana:
conda install pandana
To update pandana to a new release, run:
conda update pandana
Pandana is available on PyPI and can be installed with:
pip install -U pandana
On Windows and Mac this will install binary builds, assuming you are using a recent version of pip. On Linux it will perform a source install.
- Clone the pandana repo
- Run
python setup.py develop
(This is a C extension so requires C/C++ compilers, but should compile on Linux, Windows, and Mac.)
The default compilers on Mac do not support OpenMP (which we use to parallelize the computations). To get multithreaded Pandana on Mac you'll need to install GNU GCC and then compile Pandana from source. The easiest way to get GCC is via Homebrew or MacPorts:
- Homebrew:
brew install gcc
- MacPorts:
port install gcc
Then you must specify the GCC compilers for use during compilation
via environment variables and tell the setup.py
script explicitly
to build with OpenMP:
export CC=gcc-4.9 export CXX=g++-4.9 export USEOPENMP=1
Note
The value of the variables you set will depend on the exact version of GCC installed.
To install the latest release from source using pip:
pip install -U --no-use-wheel pandana
Our you can get the development repository
and run python setup.py install
.
After installation, executing examples/simple_example.py
will print out the
number of threads that are being utilized. If Pandana says it is using 1
thread, and your computer has multiple cores, Pandana is not installed
correctly. Check the compile output for the gcc compiler you specified
with CC
and CXX
- you might need to change the name slightly depending
on your platform - for instance g++-mp-4.9
or g++-4.8
.