2

I am having a hard time trying to install the library libpostal on a Windows system. I tried many times to install this library even with an other computer, but I didn't succeed.

I have followed differents instructions : https://github.com/openvenues/libpostal or https://github.com/openvenues/pypostal/pull/39/files and nothing working.

So, I have installed Visual Studio 2019 C++ Build Tools, MSYS2 and executed the code :

pacman -Syu
pacman -S autoconf automake curl git make libtool gcc mingw-w64-x86_64-gcc
git clone https://github.com/openvenues/libpostal
cd libpostal
cp -rf windows/* ./
./bootstrap.sh
./configure --datadir=/c
make -j4
make install

I've tried also with a different version :

pacman -S autoconf automake curl git make libtool gcc mingw-w64-x86_64-gcc
git clone https://github.com/openvenues/libpostal
cd libpostal
cp -rf windows/* ./
./bootstrap.sh
./configure --datadir=/c
make
make install
mkdir headers && cp -r /usr/include/libpostal/ headers/

Then I have executed the command to install the library :

Now start a command prompt which has access to the Microsoft toolchain. This can be done by e.g. installing the Windows 10 SDK and then running the x64 Native Tools Command Prompt.

    C:\msys64\home\eric\libpostal>lib.exe /def:libpostal.def /out:postal.lib /machine:x64
Microsoft (R) Library Manager Version 14.29.30040.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating postal.lib and postal.exp

C:\msys64\home\eric\libpostal>cd C:\Python\Python38\Scripts

C:\Python\Python38\Scripts>pip install postal --global-option=build_ext --global-option="-IC:\msys64\home\eric\libpostal\headers" --global-option="-LC:\msys64\home\eric\libpostal"
c:\python\python38\lib\site-packages\pip\_internal\commands\install.py:229: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
  cmdoptions.check_install_build_global(options)
Collecting postal
  Using cached postal-1.1.9.tar.gz (19 kB)
Requirement already satisfied: six in c:\python\python38\lib\site-packages (from postal) (1.15.0)
Skipping wheel build for postal, due to binaries being disabled for it.
Installing collected packages: postal
    Running setup.py install for postal ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\eric\\AppData\\Local\\Temp\\pip-install-lq_05aia\\postal_a89efdf6d28d45bf8f9cd4f29a72d366\\setup.py'"'"'; __file__='"'"'C:\\Users\\eric\\AppData\\Local\\Temp\\pip-install-lq_05aia\\postal_a89efdf6d28d45bf8f9cd4f29a72d366\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\msys64\home\eric\libpostal\headers' '-LC:\msys64\home\eric\libpostal' install --record 'C:\Users\eric\AppData\Local\Temp\pip-record-604ht5ta\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\python38\Include\postal'
         cwd: C:\Users\eric\AppData\Local\Temp\pip-install-lq_05aia\postal_a89efdf6d28d45bf8f9cd4f29a72d366\
    Complete output (12 lines):
    WARNING: The wheel package is not available.
    running build_ext
    building 'postal._expand' extension
    creating build
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\postal
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\msys64\home\eric\libpostal\headers -Ic:\python\python38\include -Ic:\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.8\Release\postal/pyexpand.obj -std=c99
    clÿ: Ligne de commande warning D9002ÿ: option '-std=c99' ignoring unknown
    pyexpand.c
    postal/pyexpand.c(2): fatal error C1083: Cannot open include file: 'libpostal/libpostal.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\eric\\AppData\\Local\\Temp\\pip-install-lq_05aia\\postal_a89efdf6d28d45bf8f9cd4f29a72d366\\setup.py'"'"'; __file__='"'"'C:\\Users\\eric\\AppData\\Local\\Temp\\pip-install-lq_05aia\\postal_a89efdf6d28d45bf8f9cd4f29a72d366\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\msys64\home\eric\libpostal\headers' '-LC:\msys64\home\eric\libpostal' install --record 'C:\Users\eric\AppData\Local\Temp\pip-record-604ht5ta\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\python38\Include\postal' Check the logs for full command output.

As you can see, the installation failed. This file (libpostal.h) isn't on the directory but even if I copy it manually the installation still not working.

If you could help me to install this library because I've been trying to install this library for several days.

It would be very nice of you. Thank you.

Fox White
  • 37
  • 4

2 Answers2

1

I have got a new python package that bundled the libpostal and using the python package, it can be used.

Here is the package called pypostalwin

Follow the ReadMe instructions and enjoy using libpostal from python

Tamil Selvan
  • 1,600
  • 1
  • 9
  • 25
  • I followed the ReadMe instructions to compile and build for Windows, but./configure breaks. And no idea how to link it so python knows i exists. – QuentinJS Mar 19 '23 at 01:13
0

I faced the same problem, if I remember correctly it is enough to do:

export LD_LIBRARY_PATH=your_path_to_the_lib

in your case it's /c

I was using a WSL so I don't know if it will be the same for you, but I can assure you that the problem comes from the fact that python looks for the header files of the lib in the wrong folder.

You can follow this link for more informations on the lib on windows

  • 1
    Thank you for you're reply. Please can you give more details if you succeed to install this library. Where I should run this command and what I need to modify ? Merci bcp. – Fox White Aug 10 '21 at 13:44