libicu-dev (PyICU dependency)
brew reinstall pkg-config icu4c
PyICU (pypostal dependency)
# this is the recent homebrew opt path: double check these folders exist
ls /opt/homebrew/opt/icu4c/bin
ls /opt/homebrew/opt/icu4c/sbin
# add to PATH and PKG_CONFIG_PATH
export PATH="/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:${PATH}"
export PKG_CONFIG_PATH="/opt/homebrew/opt/icu4c/lib/pkgconfig:${PKG_CONFIG_PATH}"
# ensure system clang is used for proper libstdc++ https://github.com/ovalhub/pyicu/issues/5#issuecomment-291631507
unset CC CXX
pip install --no-cached-dir --force-reinstall --no-binary=pyicu pyicu # avoid wheels from previous runs or PyPI
libpostal (pypostal dependency)
One-liner (using HEAD as v1.1 was released in 2018):
brew install --HEAD robsalasco/libpostal/libpostal
# this is the recent homebrew opt path: double check these folders exist
ls /opt/homebrew/opt/libpostal/lib
ls /opt/homebrew/opt/libpostal/include
# add to LDFLAGS and CPPFLAGS
export LDFLAGS="-L/opt/homebrew/opt/libpostal/lib ${LDFLAGS}"
export CPPFLAGS="-I/opt/homebrew/opt/libpostal/include ${CPPFLAGS}"
pip install --no-cache-dir --force-reinstall 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'}
Hi 👋
This looks weird to me (don't understand why there would be a backtick (
`
) in that line for instance, also thepip install
is weird 🤔I can suggest running
pip install -U pip setuptools wheel
before runningpip install postal
, but doubt that it'll help. There are also differences in how you installed Python (I see yours is clang based but you can also compile CPython with gcc). I can recommend pyenv, see https://github.com/ddelange/new-mac-setup.I've ported this gist to a Dockerfile which is ubuntu based.
A 'simple'
pip install
should be enough also on newer Macs (I'm on 10.15 so can't judge though), because either way, theirsetup.py
is completely platform-agnostic.Good luck!