Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nyimbi/cfc908ae3f7e077fe9f4a062c85ab6eb to your computer and use it in GitHub Desktop.
Save nyimbi/cfc908ae3f7e077fe9f4a062c85ab6eb to your computer and use it in GitHub Desktop.
Installation instructions for libicu-dev, PyICU, libpostal, pypostal on Mac OS X 10.14+

Installing PyICU, libpostal, pypostal on Mac OS X 10.14+

libicu-dev (PyICU dependency)

brew uninstall --ignore-dependencies icu4c
brew install pkg-config icu4c  # keg-only

PyICU (pypostal dependency)

pip uninstall pyicu

export PATH="/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:$PATH"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/icu4c/lib/pkgconfig"

# ensure system clang is used for proper libstdc++ https://github.com/ovalhub/pyicu/issues/5#issuecomment-291631507
unset CC CXX

pip install --no-binary=:pyicu: pyicu  # avoid wheels from previous runs or PyPI

libpostal (pypostal dependency)

brew install robsalasco/libpostal/libpostal

Or manually:

brew install curl autoconf automake libtool pkg-config gcc@8

export CC="/usr/local/bin/gcc-8"
alias gcc="gcc-8"

git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure --datadir="${HOME}/.libpostal"
make -j4
sudo make install
pip install postal

# test installation by parsing an example address
python -c "from postal.parser import parse_address; my_address = '123 Beech Lake Ct. Roswell, GA 30076'; print({v: k for k, v in dict(parse_address(my_address)).items()})"
# {'house_number': '123', 'road': 'beech lake ct.', 'city': 'roswell', 'state': 'ga', 'postcode': '30076'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment