afew works with python 2.7, 3.1 and 3.2, and requires notmuch and its python bindings. On Debian/Ubuntu systems you can install these by doing:

$ sudo aptitude install notmuch python-notmuch python-dev python-setuptools

Note: if you are installing notmuch using Homebrew on macOS, make sure to run $ brew install --with-python3 notmuch, because the brew formula doesn’t install python3 notmuch bindings by default.

Unprivileged Install

It is recommended to install afew itself inside a virtualenv as an unprivileged user, either via checking out the source code and installing via, or via pip.

# create and activate virtualenv
$ python -m venv --system-site-packages .venv
$ source .venv/bin/activate

# install via pip from PyPI:
$ pip install afew

# or install from source:
$ python install --prefix=~/.local

You might want to symlink .venv/bin/afew somewhere inside your path (~/bin/ in this case):

$ ln -snr .venv/bin/afew ~/.bin/afew