openvenues / libpostal

A C library for parsing/normalizing street addresses around the world. Powered by statistical NLP and open geo data.
MIT License
4.09k stars 421 forks source link

Python bindings installation fails #10

Closed riordan closed 9 years ago

riordan commented 9 years ago

I keep running into errors while attempting to install the Python bindings (Ubuntu 14.04 + OS X Snow Leopard).

pip installing (locally or from github) leads to:

    building 'postal.text._normalize' extension
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I. -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/normalize.c -o build/temp.macosx-10.10-intel-2.7/src/normalize.o -std=c99 -DHAVE_CONFIG_H -Wno-unused-function
    In file included from src/normalize.c:1:
    In file included from src/normalize.h:36:
    In file included from src/transliterate.h:12:
    In file included from src/trie.h:32:
    In file included from src/file_utils.h:11:
    src/libpostal_config.h:7:14: fatal error: 'config.h' file not found
        #include <config.h>
                 ^
    1 error generated.
    error: command 'cc' failed with exit status 1

    ----------------------------------------
Command "/Users/driordan/Data/datapy/bin/python -c "import setuptools, tokenize;__file__='/var/folders/mx/2mwxpy5j4nvdfw53dy44xdk80000gn/T/pip-ZN5DJj-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/mx/2mwxpy5j4nvdfw53dy44xdk80000gn/T/pip-CxQMdy-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/driordan/Data/datapy/include/site/python2.7/pypostal" failed with error code 1 in /var/folders/mx/2mwxpy5j4nvdfw53dy44xdk80000gn/T/pip-ZN5DJj-build

I'm foggy enough as is on C build processes, so debugging C meets bindings is hairy territory for me.

Additionally, readme.md needs to be updated so that pip install https is pip install git+https to facilitate installing from GitHub (was going to open a PR, but figured the other install issues took precedence). Figure that makes more sense once the general install issue's worked out.

albarrentine commented 9 years ago

The move to autoconf may be breaking simple pip installs. Removed that from the Readme.

At the moment the Python lib (pypostal) only does tokenization and basic string normalization, as this was necessary to create some of the training data, so it may not be entirely useful to you until the bindings to the main API and the address parser are added.

The best way to install pypostal is:

git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure --datadir=[some dir with 500MB of space]
python setup.py install

Tested on Ubuntu 14.04.

For the release, I'll try to cook up something simpler so people can include libpostal in a requirements.txt. It should be possible to configure the data directory in a pip install using something like "--install-options".

steveha-ziprecruiter commented 8 years ago

When I was trying to figure out the Python bindings, Google found this issue and I tried the process documented above. This is no longer the correct process. The Python bindings are now in their own GitHub repository and are now installed using sudo pip install

See the documentation here:https://github.com/openvenues/pypostal/blob/master/README.md