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)
One-liner (using HEAD as v1.1 was released in 2018):
brew install --HEAD 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.git
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'}
I am having no end of trouble getting postal installed on an M1 Mac running OX 13.1 (Ventura). I have installed and uninstalled lib postal and the BREW command above seems to work flawlessly. However, in every install, I'm getting errors building the wheel. I've tried using the --use-pep517 argument and get the same result.
lovejodh ~ % pip install postal
Collecting postal
Using cached postal-1.1.10.tar.gz (21 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: six in /opt/homebrew/lib/python3.11/site-packages (from postal) (1.16.0)
Building wheels for collected packages: postal
Building wheel for postal (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [40 lines of output]
/opt/homebrew/lib/python3.11/site-packages/setuptools/dist.py:788: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
/opt/homebrew/lib/python3.11/site-packages/setuptools/init.py:85: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try
pip install --use-pep517
.dist.fetch_build_eggs(dist.setup_requires)
/opt/homebrew/lib/python3.11/site-packages/setuptools/dist.py:788: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-13-arm64-cpython-311
creating build/lib.macosx-13-arm64-cpython-311/postal
copying postal/token_types.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/dedupe.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/normalize.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/init.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/parser.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/near_dupe.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/tokenize.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/expand.py -> build/lib.macosx-13-arm64-cpython-311/postal
creating build/lib.macosx-13-arm64-cpython-311/postal/tests
copying postal/tests/test_parser.py -> build/lib.macosx-13-arm64-cpython-311/postal/tests
copying postal/tests/init.py -> build/lib.macosx-13-arm64-cpython-311/postal/tests
copying postal/tests/test_expand.py -> build/lib.macosx-13-arm64-cpython-311/postal/tests
copying postal/tests/_test_near_dupes.py -> build/lib.macosx-13-arm64-cpython-311/postal/tests
creating build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/utils/encoding.py -> build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/utils/init.py -> build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/utils/omitted.py -> build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/utils/enum.py -> build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/pyutils.h -> build/lib.macosx-13-arm64-cpython-311/postal
running build_ext
building 'postal._expand' extension
creating build/temp.macosx-13-arm64-cpython-311
creating build/temp.macosx-13-arm64-cpython-311/postal
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/Users/lovejodh/libpostal/include -L/Users/lovejodh/libpostal/lib` pip install postal -I/usr/local/include -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c postal/pyexpand.c -o build/temp.macosx-13-arm64-cpython-311/postal/pyexpand.o -std=c99
clang: error: no such file or directory: 'pip'
clang: error: no such file or directory: 'install'
clang: warning: postal: 'linker' input unused [-Wunused-command-line-argument]
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for postal
Running setup.py clean for postal
Failed to build postal
ERROR: Could not build wheels for postal, which is required to install pyproject.toml-based projects
lovejodh@MBP-P32402PG63-US ~ % pip install postal --use-pep517
Collecting postal
Using cached postal-1.1.10.tar.gz (21 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: six in /opt/homebrew/lib/python3.11/site-packages (from postal) (1.16.0)
Building wheels for collected packages: postal
Building wheel for postal (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for postal (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [36 lines of output]
/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/dist.py:788: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-13-arm64-cpython-311
creating build/lib.macosx-13-arm64-cpython-311/postal
copying postal/token_types.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/dedupe.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/normalize.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/init.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/parser.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/near_dupe.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/tokenize.py -> build/lib.macosx-13-arm64-cpython-311/postal
copying postal/expand.py -> build/lib.macosx-13-arm64-cpython-311/postal
creating build/lib.macosx-13-arm64-cpython-311/postal/tests
copying postal/tests/test_parser.py -> build/lib.macosx-13-arm64-cpython-311/postal/tests
copying postal/tests/init.py -> build/lib.macosx-13-arm64-cpython-311/postal/tests
copying postal/tests/test_expand.py -> build/lib.macosx-13-arm64-cpython-311/postal/tests
copying postal/tests/_test_near_dupes.py -> build/lib.macosx-13-arm64-cpython-311/postal/tests
creating build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/utils/encoding.py -> build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/utils/init.py -> build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/utils/omitted.py -> build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/utils/enum.py -> build/lib.macosx-13-arm64-cpython-311/postal/utils
copying postal/pyutils.h -> build/lib.macosx-13-arm64-cpython-311/postal
running build_ext
building 'postal._expand' extension
creating build/temp.macosx-13-arm64-cpython-311
creating build/temp.macosx-13-arm64-cpython-311/postal
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/Users/lovejodh/libpostal/include -L/Users/lovejodh/libpostal/lib` pip install postal -I/usr/local/include -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c postal/pyexpand.c -o build/temp.macosx-13-arm64-cpython-311/postal/pyexpand.o -std=c99
clang: error: no such file or directory: 'pip'
clang: error: no such file or directory: 'install'
clang: warning: postal: 'linker' input unused [-Wunused-command-line-argument]
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for postal
Failed to build postal
ERROR: Could not build wheels for postal, which is required to install pyproject.toml-based projects