Civis API Python Client

The Civis API Python client is a Python package that helps analysts and developers interact with the Civis Platform. The package includes a set of tools around common workflows as well as a convenient interface to make requests directly to the Civis API.


The recommended install method is pip:

pip install civis

Alternatively, you may clone the code from GitHub and build from source:

git clone
cd civis-python
python install

The client has a soft dependency on pandas to support features such as data type parsing. If you are using the io namespace to read or write data from Civis, it is highly recommended that you install pandas and set use_pandas=True in functions that accept that parameter. To install pandas:

pip install pandas

Machine learning features in the ml namespace have a soft dependency on scikit-learn and pandas. Install scikit-learn to export your trained models from the Civis Platform or to provide your own custom models. Use pandas to download model predictions from the Civis Platform. The code optionally uses the feather format to transfer data from your local computer to Civis Platform. Install these dependencies with

pip install scikit-learn
pip install pandas
pip install feather-format

Some CivisML models have open-source dependencies in addition to scikit-learn, which you may need if you want to download the model object. These dependencies are civisml-extensions, glmnet, and muffnn. Install these dependencies with

pip install civisml-extensions
pip install glmnet
pip install muffnn

Python version support

Python 2.7, 3.4, 3.5, and 3.6


In order to make requests to the Civis API, you will need an API key that is unique to you. Instructions for creating a new key are found here: By default, the Python client will look for your key in the environment variable CIVIS_API_KEY. To add the API key to your environment, copy the key you generated to your clipboard and follow the instructions below for your operating system.


Open .bash_profile in TextEdit:

cd ~/
touch .bash_profile
open -e .bash_profile

Then add the following line, replacing api_key_here with your key:

export CIVIS_API_KEY="api_key_here"


Open .bashrc in your favorite editor (nano is used here):

cd ~/
nano .bashrc

Then add the following line, replacing api_key_here with your key:

export CIVIS_API_KEY="api_key_here"

User Guide

For a more detailed walkthrough, see the User Guide.

Indices and tables