pip install postal fails: libpostal.h not found

Updated 27 November 2026 · plain markdown

Short answer

postal (Python) and node-postal (Node) are thin bindings. They do not ship libpostal. You must build the libpostal C library and download its model data (about 1.8 GB) before the binding will compile. Steps are below. If you only need parsed fields, you can skip the build and call libpostal over HTTP instead.

The error in Python

pip install postal (postal 1.1.11) on a machine without libpostal:

postal/pyexpand.c:2:10: fatal error: libpostal/libpostal.h: No such file or directory
    2 | #include <libpostal/libpostal.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
  ERROR: Failed building wheel for postal
Failed to build postal

pip is fine. The C compiler cannot find libpostal's header, because libpostal is not installed.

The error in Node (it hides)

npm install node-postal (1.3.0) on the same machine prints no error at all:

added 4 packages, and audited 5 packages in 502ms

found 0 vulnerabilities

The package's install script is node-gyp rebuild || (exit 0), so a failed build still exits 0, and npm hides install-script output by default. You find out later, at require:

Error: Could not locate the bindings file. Tried:
 → node_modules/node-postal/build/expand.node
 → node_modules/node-postal/build/Release/expand.node

Run npm install node-postal --foreground-scripts to see the real cause. It is the same missing header:

../src/expand.cc:1:10: fatal error: libpostal/libpostal.h: No such file or directory
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2

Fix: build libpostal first

These are the steps from the libpostal README, and the same ones our production image runs. Install build tools (Debian or Ubuntu):

sudo apt-get install -y build-essential autoconf automake libtool pkg-config git curl

Build and install libpostal. --datadir is where the model files go:

git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure --datadir=/opt/libpostal_data
make -j"$(nproc)"
sudo make install
sudo ldconfig

Then the bindings build:

pip install postal        # Python
npm install node-postal   # Node

Check it works:

python3 -c "from postal.parser import parse_address; print(parse_address('10 Downing St, London SW1A 2AA'))"

Things that catch people out:

Or skip the build: call libpostal over HTTP

parseaddr runs that same build for you. One POST returns libpostal's labels:

curl -s https://api.parseaddr.com/v1/parse \
  -H "Authorization: Bearer $PARSEADDR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"address":"flat 3b, 221 baker st, london nw1 6xe uk"}'

Response, trimmed to the parsed field:

{"parsed": {"unit": "flat 3b", "house_number": "221", "road": "baker st",
            "city": "london", "postcode": "nw1 6xe", "country": "uk"}}

In Python that is a few lines with no C build:

import httpx, os
r = httpx.post(
    "https://api.parseaddr.com/v1/parse",
    headers={"Authorization": f"Bearer {os.environ['PARSEADDR_API_KEY']}"},
    json={"address": "Apt 4, 1600 Pennsylvania Ave NW, Washington DC 20500"},
)
print(r.json()["parsed"])
# {'unit': 'apt 4', 'house_number': '1600', 'road': 'pennsylvania ave nw',
#  'city': 'washington', 'state': 'dc', 'postcode': '20500'}

The free plan is 2,000 calls a month with no card. Paid plans start at £19 a month for 25,000 calls. See pricing.

Get a free keyAPI reference

When to keep self-hosting

Hosted is not always the right call. Build libpostal yourself if:

More detail: parseaddr vs self-hosted libpostal.

parseaddr · home · agents · pricing · llms.txt · .md
Pyke Limited, registered in England and Wales, company number 09748427.