I followed the instructions and installed libpostal.
git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
mkdir ~/libpostal-datadir
./configure --datadir=~/libpostal-datadir
make
I ran into issues with language_classifier failing, but downloaded it manually with curl:
curl http://libpostal.s3.amazonaws.com/language_classifier.tar.gz -o ~/libpostal-datadir/libpostal/language_classifier.tar.gz
cd ~/libpostal-datadir/libpostal
tar -xzf language_classifier.tar.gz
➜ libpostal git:(master) ✗ src/address_parser
Loading models...
Welcome to libpostal's address parser.
Type in any address to parse and print the result.
Special commands:
.language [code] to specify a language
.country [code] to specify a country
.exit to quit the program
> 123 Main Street
Result:
{
"house_number": "123",
"road": "main street"
}
>
(country-append) ➜ pypostal git:(master) pip install postal
Collecting postal
Using cached postal-0.3.tar.gz
Requirement already satisfied: six in /Users/nicole/.virtualenvs/country-append/lib/python2.7/site-packages (from postal)
Building wheels for collected packages: postal
Running setup.py bdist_wheel for postal ... error
Complete output from command /Users/nicole/.virtualenvs/country-append/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8f/_lk_kbrj49q3b317sp3b9y1c0000gn/T/pip-build-AbquqQ/postal/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/8f/_lk_kbrj49q3b317sp3b9y1c0000gn/T/tmpF3t5tapip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/postal
copying postal/__init__.py -> build/lib.macosx-10.12-intel-2.7/postal
copying postal/expand.py -> build/lib.macosx-10.12-intel-2.7/postal
copying postal/parser.py -> build/lib.macosx-10.12-intel-2.7/postal
creating build/lib.macosx-10.12-intel-2.7/postal/tests
copying postal/tests/__init__.py -> build/lib.macosx-10.12-intel-2.7/postal/tests
copying postal/tests/test_expand.py -> build/lib.macosx-10.12-intel-2.7/postal/tests
copying postal/tests/test_parser.py -> build/lib.macosx-10.12-intel-2.7/postal/tests
creating build/lib.macosx-10.12-intel-2.7/postal/utils
copying postal/utils/__init__.py -> build/lib.macosx-10.12-intel-2.7/postal/utils
copying postal/utils/encoding.py -> build/lib.macosx-10.12-intel-2.7/postal/utils
copying postal/utils/enum.py -> build/lib.macosx-10.12-intel-2.7/postal/utils
copying postal/utils/omitted.py -> build/lib.macosx-10.12-intel-2.7/postal/utils
running build_ext
building 'postal._expand' extension
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/postal
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch i386 -arch x86_64 -pipe -I/usr/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c postal/pyexpand.c -o build/temp.macosx-10.12-intel-2.7/postal/pyexpand.o -std=c99 -Wno-unused-function
postal/pyexpand.c:2:10: fatal error: 'libpostal/libpostal.h' file not found
#include <libpostal/libpostal.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Failed building wheel for postal
Running setup.py clean for postal
Failed to build postal
Installing collected packages: postal
Running setup.py install for postal ... error
Complete output from command /Users/nicole/.virtualenvs/country-append/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8f/_lk_kbrj49q3b317sp3b9y1c0000gn/T/pip-build-AbquqQ/postal/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/8f/_lk_kbrj49q3b317sp3b9y1c0000gn/T/pip-E3CTvr-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/nicole/.virtualenvs/country-append/include/site/python2.7/postal:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/postal
copying postal/__init__.py -> build/lib.macosx-10.12-intel-2.7/postal
copying postal/expand.py -> build/lib.macosx-10.12-intel-2.7/postal
copying postal/parser.py -> build/lib.macosx-10.12-intel-2.7/postal
creating build/lib.macosx-10.12-intel-2.7/postal/tests
copying postal/tests/__init__.py -> build/lib.macosx-10.12-intel-2.7/postal/tests
copying postal/tests/test_expand.py -> build/lib.macosx-10.12-intel-2.7/postal/tests
copying postal/tests/test_parser.py -> build/lib.macosx-10.12-intel-2.7/postal/tests
creating build/lib.macosx-10.12-intel-2.7/postal/utils
copying postal/utils/__init__.py -> build/lib.macosx-10.12-intel-2.7/postal/utils
copying postal/utils/encoding.py -> build/lib.macosx-10.12-intel-2.7/postal/utils
copying postal/utils/enum.py -> build/lib.macosx-10.12-intel-2.7/postal/utils
copying postal/utils/omitted.py -> build/lib.macosx-10.12-intel-2.7/postal/utils
running build_ext
building 'postal._expand' extension
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/postal
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch i386 -arch x86_64 -pipe -I/usr/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c postal/pyexpand.c -o build/temp.macosx-10.12-intel-2.7/postal/pyexpand.o -std=c99 -Wno-unused-function
postal/pyexpand.c:2:10: fatal error: 'libpostal/libpostal.h' file not found
#include <libpostal/libpostal.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/Users/nicole/.virtualenvs/country-append/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/8f/_lk_kbrj49q3b317sp3b9y1c0000gn/T/pip-build-AbquqQ/postal/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/8f/_lk_kbrj49q3b317sp3b9y1c0000gn/T/pip-E3CTvr-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/nicole/.virtualenvs/country-append/include/site/python2.7/postal" failed with error code 1 in /private/var/folders/8f/_lk_kbrj49q3b317sp3b9y1c0000gn/T/pip-build-AbquqQ/postal/
(country-append) ➜ pypostal git:(master) echo $PKG_CONFIG_PATH
/Users/nicole/GitHub/libpostal
However it still fails with the same error. I've also tried cloning this repository and installing with python setup.py install
but get the same error. Any help is appreciated!