pypostal icon indicating copy to clipboard operation
pypostal copied to clipboard

can't install it via pip on Windows

Open ImCarrot opened this issue 6 years ago • 34 comments

C:>pip install postal Collecting postal Using cached postal-1.0.tar.gz Requirement already satisfied: six in c:\program files\python36\lib\site-packages (from postal) Installing collected packages: postal Running setup.py install for postal ... error Complete output from command "c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\adity\AppData\Local\Temp\pip-build-ye1wzy53\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 C:\Users\adity\AppData\Local\Temp\pip-g4h3aprc-record\install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build\lib.win-amd64-3.6 creating build\lib.win-amd64-3.6\postal copying postal\expand.py -> build\lib.win-amd64-3.6\postal copying postal\parser.py -> build\lib.win-amd64-3.6\postal copying postal_init_.py -> build\lib.win-amd64-3.6\postal creating build\lib.win-amd64-3.6\postal\tests copying postal\tests\test_expand.py -> build\lib.win-amd64-3.6\postal\tests copying postal\tests\test_parser.py -> build\lib.win-amd64-3.6\postal\tests copying postal\tests_init_.py -> build\lib.win-amd64-3.6\postal\tests creating build\lib.win-amd64-3.6\postal\utils copying postal\utils\encoding.py -> build\lib.win-amd64-3.6\postal\utils copying postal\utils\enum.py -> build\lib.win-amd64-3.6\postal\utils copying postal\utils\omitted.py -> build\lib.win-amd64-3.6\postal\utils copying postal\utils_init_.py -> build\lib.win-amd64-3.6\postal\utils running build_ext building 'postal._expand' extension creating build\temp.win-amd64-3.6 creating build\temp.win-amd64-3.6\Release creating build\temp.win-amd64-3.6\Release\postal C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include "-Ic:\program files\python36\include" "-Ic:\program files\python36\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.6\Release\postal/pyexpand.obj -std=c99 -Wno-unused-function cl : Command line error D8021 : invalid numeric argument '/Wno-unused-function' error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

----------------------------------------

Command ""c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\adity\AppData\Local\Temp\pip-build-ye1wzy53\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 C:\Users\adity\AppData\Local\Temp\pip-g4h3aprc-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\adity\AppData\Local\Temp\pip-build-ye1wzy53\postal\

ImCarrot avatar Nov 16 '17 14:11 ImCarrot

I have the c++ 14.0 already installed and is working perfectly for other installations like implicit and stuff.

ImCarrot avatar Nov 16 '17 14:11 ImCarrot

Hi Aditya, sorry, libpostal does not support Windows at present. There's a pull request on the main repo currently to provide Windows support through MSYS2 or MingW64. Not sure if anything special needs to be done for the Python bindings as well.

Also, libpostal (the C library) has to be installed before running pip install.

albarrentine avatar Nov 24 '17 20:11 albarrentine

@albarrentine

Also, libpostal (the C library) has to be installed before running pip install.

I am not sure how?

Is there any timelines as to when will I able to install it on my windows machine?

ImCarrot avatar Nov 25 '17 05:11 ImCarrot

The C library is at: https://github.com/openvenues/libpostal, and that library needs to be installed first (it's like needing to install libxml2 system-wide before installing lxml), as documented in the README.

At least one user has reported getting libpostal to work on Windows. Please see the following repo for Windows instructions: https://github.com/BenK10/libpostal_windows/tree/v2.0.

Note: I've said this before in other issues but I do not personally have any Windows machines and only ever intended this library to be used on Mac & Linux, so am depending heavily on the community for anything related to Windows compatibility.

There's an open pull request here https://github.com/openvenues/libpostal/pull/272 which is being worked out at the moment, and if it's possible to add that into the main repo without adding too much extra upkeep, I'll be happy to merge it.

albarrentine avatar Nov 25 '17 06:11 albarrentine

Hi @albarrentine ,

It took me a while to figure out how to install libpostal on windows, even after seeing this issue thread.

From the readme of pypostal, it is not clear that there has been a succesfull update that includes windows support (https://github.com/openvenues/libpostal/pull/272) using MSYS. For the sake of other people who are stuck with windows, could you update the pypostal readme or point more explicitly to the libpostal readme?

However, even though I believe that I now have succesfully installed libpostal on my windows machine, I still can't get pypostal to install.

pip install pypostal

Collecting pypostal Using cached pyPostal-1.1.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "C:\Users\rouxrei\AppData\Local\Temp\pip-build-t2qh4ca1\pypostal\setup.py", line 10, in long_description=codecs.open('README.rst', "r", "utf-8").read(), File "c:\program files\python\lib\codecs.py", line 895, in open file = builtins.open(filename, mode, buffering) FileNotFoundError: [Errno 2] No such file or directory: 'README.rst'

-> This seems to be a particulary stupid error that looks to be introduced by myself. But I'm too new to python to be sure...

python .\setup.py install

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:/usr/local/lib "/LIBPATH:C:\Program Files\Python\libs" "/LIBPATH:C:\Program Files\Python\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64" libpostal.lib /EXPORT:PyInit__token_types build\temp.win-amd64-3.6\Release\postal/pytokentypes.obj /OUT:build\lib.win-amd64-3.6\postal_token_types.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\postal_token_types.cp36-win_amd64.lib LINK : error LNK2001: unresolved external symbol PyInit__token_types build\temp.win-amd64-3.6\Release\postal_token_types.cp36-win_amd64.lib : fatal error LNK1120: 1 unresolved externals error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\link.exe' failed with exit status 1120

rouxrei avatar Jan 04 '18 13:01 rouxrei

Oh, it should be pip install postal as the name "pypostal" was already taken on PyPI (and somehow "postal" was not).

Windows support is fairly recent in the underlying C library itself, and has not made it to the bindings yet (there's a pull request in #25, which I'd like to get tested with an Appveyor build before merging, as I have no Windows machines and would like to know when I break anything - feel free to try out those changes though in the meantime).

albarrentine avatar Jan 05 '18 22:01 albarrentine

Hi @albarrentine,

That was stupid on my part.

However pip install postal still uses the 'old' setup.py file resulting in the error: cl : Command line error D8021 : invalid numeric argument '/Wno-unused-function'

I've cloned AeroXuk:master, but again I get this error: LINK : error LNK2001: unresolved external symbol PyInit__token_types

The problem here is that I have no experience with Ms Virtual Studio Tools and google tell me that this is a 'generic' linking error. So I was hoping an experienced C developer (like yourself) would have a clue of why the linking is failing, even though it's on an environment you have no experience with either.

I can have a look at creating a .yml file, do you have a good resource to read for creating such a yml file?

rouxrei avatar Jan 08 '18 08:01 rouxrei

Not your fault by any means. I'm finishing up a release so there are a few recent changes to the Python binding and not all of them are tested/documented/compatible with every platform yet.

I've merged the new commits from master into that branch which should hopefully fix the Windows/Python3 issues.

Would love an appveyor.yml to get #25 tested and merged. Here's an example of the appveyor config from libpostal's C library: https://github.com/openvenues/libpostal/blob/master/.appveyor.yml. Can copy and modify that. It uses similar syntax to the Travis configs - so it should be mostly a matter of merging ideas from the C appveyor config with the Python repo's Travis config, which can be found here: https://github.com/openvenues/pypostal/blob/master/.travis.yml. AppVeyor is set up to build this repo, so a pull request that has an appveyor.yml will automatically build.

albarrentine avatar Jan 16 '18 18:01 albarrentine

Hi @albarrentine , I found your work and been trying to use it I think I've finally managed to install it correctly in Windows using all the instructions on the main page and on this thread.

Nevertheless, once I try to use the pip install postal instruction I still get the error: pip install postal Collecting postal Using cached https://files.pythonhosted.org/packages/3d/0b/2f077c14165c0e4ed795c3fa83e1b68d357186da42ee3ab5d64b77424f12/postal-1.1.7.tar.gz Requirement already satisfied: six in c:\users\josen\anaconda3\lib\site-packages (from postal) (1.11.0) Building wheels for collected packages: postal Running setup.py bdist_wheel for postal ... error Complete output from command C:\Users\josen\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='c:\users\josen\appdata\local\temp\pip-install-d4kh3m\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 c:\users\josen\appdata\local\temp\pip-wheel-6m9pho --python-tag cp27: running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-2.7 creating build\lib.win-amd64-2.7\postal copying postal\dedupe.py -> build\lib.win-amd64-2.7\postal copying postal\expand.py -> build\lib.win-amd64-2.7\postal copying postal\near_dupe.py -> build\lib.win-amd64-2.7\postal copying postal\normalize.py -> build\lib.win-amd64-2.7\postal copying postal\parser.py -> build\lib.win-amd64-2.7\postal copying postal\tokenize.py -> build\lib.win-amd64-2.7\postal copying postal\token_types.py -> build\lib.win-amd64-2.7\postal copying postal_init_.py -> build\lib.win-amd64-2.7\postal creating build\lib.win-amd64-2.7\postal\tests copying postal\tests\test_expand.py -> build\lib.win-amd64-2.7\postal\tests copying postal\tests\test_near_dupes.py -> build\lib.win-amd64-2.7\postal\tests copying postal\tests\test_parser.py -> build\lib.win-amd64-2.7\postal\tests copying postal\tests_init_.py -> build\lib.win-amd64-2.7\postal\tests creating build\lib.win-amd64-2.7\postal\utils copying postal\utils\encoding.py -> build\lib.win-amd64-2.7\postal\utils copying postal\utils\enum.py -> build\lib.win-amd64-2.7\postal\utils copying postal\utils\omitted.py -> build\lib.win-amd64-2.7\postal\utils copying postal\utils_init_.py -> build\lib.win-amd64-2.7\postal\utils copying postal\pyutils.h -> build\lib.win-amd64-2.7\postal running build_ext building 'postal._expand' extension creating build\temp.win-amd64-2.7 creating build\temp.win-amd64-2.7\Release creating build\temp.win-amd64-2.7\Release\postal C:\Users\josen\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/local/include -IC:\Users\josen\Anaconda3\include -IC:\Users\josen\Anaconda3\PC /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-2.7\Release\postal/pyexpand.obj -std=c99 cl : Command line warning D9002 : ignoring unknown option '-std=c99' pyexpand.c postal/pyexpand.c(2) : fatal error C1083: Cannot open include file: 'libpostal/libpostal.h': No such file or directory error: command 'C:\Users\josen\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2


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 C:\Users\josen\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='c:\users\josen\appdata\local\temp\pip-install-d4kh3m\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 c:\users\josen\appdata\local\temp\pip-record-wlzwzv\install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build\lib.win-amd64-2.7 creating build\lib.win-amd64-2.7\postal copying postal\dedupe.py -> build\lib.win-amd64-2.7\postal copying postal\expand.py -> build\lib.win-amd64-2.7\postal copying postal\near_dupe.py -> build\lib.win-amd64-2.7\postal copying postal\normalize.py -> build\lib.win-amd64-2.7\postal copying postal\parser.py -> build\lib.win-amd64-2.7\postal copying postal\tokenize.py -> build\lib.win-amd64-2.7\postal copying postal\token_types.py -> build\lib.win-amd64-2.7\postal copying postal_init_.py -> build\lib.win-amd64-2.7\postal creating build\lib.win-amd64-2.7\postal\tests copying postal\tests\test_expand.py -> build\lib.win-amd64-2.7\postal\tests copying postal\tests\test_near_dupes.py -> build\lib.win-amd64-2.7\postal\tests copying postal\tests\test_parser.py -> build\lib.win-amd64-2.7\postal\tests copying postal\tests_init_.py -> build\lib.win-amd64-2.7\postal\tests creating build\lib.win-amd64-2.7\postal\utils copying postal\utils\encoding.py -> build\lib.win-amd64-2.7\postal\utils copying postal\utils\enum.py -> build\lib.win-amd64-2.7\postal\utils copying postal\utils\omitted.py -> build\lib.win-amd64-2.7\postal\utils copying postal\utils_init_.py -> build\lib.win-amd64-2.7\postal\utils copying postal\pyutils.h -> build\lib.win-amd64-2.7\postal running build_ext building 'postal._expand' extension creating build\temp.win-amd64-2.7 creating build\temp.win-amd64-2.7\Release creating build\temp.win-amd64-2.7\Release\postal C:\Users\josen\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/local/include -IC:\Users\josen\Anaconda3\include -IC:\Users\josen\Anaconda3\PC /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-2.7\Release\postal/pyexpand.obj -std=c99 cl : Command line warning D9002 : ignoring unknown option '-std=c99' pyexpand.c postal/pyexpand.c(2) : fatal error C1083: Cannot open include file: 'libpostal/libpostal.h': No such file or directory error: command 'C:\Users\josen\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2

----------------------------------------

Command "C:\Users\josen\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='c:\users\josen\appdata\local\temp\pip-install-d4kh3m\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 c:\users\josen\appdata\local\temp\pip-record-wlzwzv\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\josen\appdata\local\temp\pip-install-d4kh3m\postal
I don't know if I'm doing something wrong in the installation or if I'm not understanding well enough and the library is only supposed to be working on Windows through C and not using python, as you may have noticed I'm not a proper programmer

sorry for the inconvenience

jnbaene avatar Jun 28 '18 16:06 jnbaene

@jnbaene the instructions in PR #36 might work for you

batterseapower avatar Aug 09 '18 07:08 batterseapower

@batterseapower I've tried the PR #36 instructions just now with VS 2017 and it dies due to providing the msys include directory to cl.exe:

c:\python37\lib\site-packages\pip\_internal\commands\install.py:199: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
  cmdoptions.check_install_build_global(options)
Collecting postal
  Using cached https://files.pythonhosted.org/packages/3d/0b/2f077c14165c0e4ed795c3fa83e1b68d357186da42ee3ab5d64b77424f12/postal-1.1.7.tar.gz
Requirement already satisfied: six in c:\python37\lib\site-packages (from postal) (1.11.0)
Skipping bdist_wheel for postal, due to binaries being disabled for it.
Installing collected packages: postal
  Running setup.py install for postal ... error
    Complete output from command c:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\USERNAME\\AppData\\Local\\Temp\\pip-install-2hfg5bx5\\postal\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext -IC:\msys64\usr\include -LC:\Users\USERNAME\Source\Repos\libpostal install --record C:\Users\USERNAME\AppData\Local\Temp\pip-record-1wkizbh2\install-record.txt --single-version-externally-managed --compile:
    running build_ext
    building 'postal._expand' extension
    creating build
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\postal
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\msys64\usr\include -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.7\Release\postal/pyexpand.obj -std=c99
    cl : Command line warning D9002 : ignoring unknown option '-std=c99'
    pyexpand.c
    C:\msys64\usr\include\sys/cdefs.h(721): warning C4005: '__guarded_by': macro redefinition
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\concurrencysal.h(317): note: see previous definition of '__guarded_by'
    C:\msys64\usr\include\sys/_types.h(94): error C2054: expected '(' to follow '__extension__'
    C:\msys64\usr\include\sys/_types.h(94): error C2085: '_off64_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(100): error C2085: '__off_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(103): error C2085: '_off64_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(103): error C2146: syntax error: missing ',' before identifier '__loff_t'
    C:\msys64\usr\include\sys/_types.h(114): error C2085: '_fpos_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(132): error C2085: '__size_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(149): error C2085: '_ssize_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(156): error C2085: '_ssize_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(156): error C2146: syntax error: missing ',' before identifier '__ssize_t'
    C:\msys64\usr\include\sys/_types.h(169): error C2057: expected constant expression
    C:\msys64\usr\include\sys/_types.h(171): error C2085: '_mbstate_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(175): error C2085: '_flock_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(180): error C2085: '_iconv_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(187): error C2085: '__clock_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(194): error C2085: '__time_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(197): error C2085: '__clockid_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(200): error C2085: '__timer_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(210): error C2085: '__nlink_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(211): error C2085: '__suseconds_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(212): error C2085: '__useconds_t': not in formal parameter list
    C:\msys64\usr\include\sys/_types.h(217): error C2085: '__va_list': not in formal parameter list
    C:\msys64\usr\include\sys/reent.h(22): error C2085: '__ULong': not in formal parameter list
    C:\msys64\usr\include\sys/reent.h(51): error C2061: syntax error: identifier '__ULong'
    C:\msys64\usr\include\sys/reent.h(52): error C2059: syntax error: '}'
    C:\msys64\usr\include\sys/reent.h(78): error C2061: syntax error: identifier '__ULong'
    C:\msys64\usr\include\sys/reent.h(81): error C2061: syntax error: identifier '_is_cxa'
    C:\msys64\usr\include\sys/reent.h(81): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(82): error C2059: syntax error: '}'
    C:\msys64\usr\include\sys/reent.h(98): error C2079: '_on_exit_args' uses undefined struct '_on_exit_args'
    C:\msys64\usr\include\sys/reent.h(202): error C2061: syntax error: identifier '_fpos_t'
    C:\msys64\usr\include\sys/reent.h(226): error C2061: syntax error: identifier '_lock'
    C:\msys64\usr\include\sys/reent.h(226): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(228): error C2061: syntax error: identifier '_mbstate'
    C:\msys64\usr\include\sys/reent.h(228): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(230): error C2059: syntax error: '}'
    C:\msys64\usr\include\sys/reent.h(608): error C2061: syntax error: identifier '__extension__'
    C:\msys64\usr\include\sys/reent.h(610): error C2061: syntax error: identifier '_mblen_state'
    C:\msys64\usr\include\sys/reent.h(610): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(611): error C2061: syntax error: identifier '_mbtowc_state'
    C:\msys64\usr\include\sys/reent.h(611): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(612): error C2061: syntax error: identifier '_wctomb_state'
    C:\msys64\usr\include\sys/reent.h(612): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(616): error C2061: syntax error: identifier '_mbrlen_state'
    C:\msys64\usr\include\sys/reent.h(616): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(617): error C2061: syntax error: identifier '_mbrtowc_state'
    C:\msys64\usr\include\sys/reent.h(617): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(618): error C2061: syntax error: identifier '_mbsrtowcs_state'
    C:\msys64\usr\include\sys/reent.h(618): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(619): error C2061: syntax error: identifier '_wcrtomb_state'
    C:\msys64\usr\include\sys/reent.h(619): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(620): error C2061: syntax error: identifier '_wcsrtombs_state'
    C:\msys64\usr\include\sys/reent.h(620): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/reent.h(622): error C2059: syntax error: '}'
    C:\msys64\usr\include\sys/reent.h(632): error C2059: syntax error: '}'
    C:\msys64\usr\include\sys/reent.h(648): error C2079: '__sf' uses undefined struct '__sFILE'
    C:\msys64\usr\include\sys/reent.h(650): error C2059: syntax error: '}'
    C:\msys64\usr\include\sys/_stdint.h(77): error C2371: 'intptr_t': redefinition; different basic types
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\vcruntime.h(182): note: see declaration of 'intptr_t'
    C:\msys64\usr\include\sys/_stdint.h(82): error C2371: 'uintptr_t': redefinition; different basic types
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\vadefs.h(28): note: see declaration of 'uintptr_t'
    C:\msys64\usr\include\machine/_endian.h(23): error C2054: expected '(' to follow '__inline__'
    C:\msys64\usr\include\machine/_endian.h(23): error C2085: '__ntohl': not in formal parameter list
    C:\msys64\usr\include\machine/_endian.h(24): error C2082: redefinition of formal parameter '__inline__'
    C:\msys64\usr\include\machine/_endian.h(24): error C2146: syntax error: missing ',' before identifier '__uint16_t'
    C:\msys64\usr\include\machine/_endian.h(24): error C2146: syntax error: missing ',' before identifier '__ntohs'
    C:\msys64\usr\include\machine/_endian.h(24): error C2143: syntax error: missing ';' before '('
    C:\msys64\usr\include\machine/_endian.h(24): error C2059: syntax error: ')'
    C:\msys64\usr\include\machine/_endian.h(27): error C2054: expected '(' to follow '__inline__'
    C:\msys64\usr\include\machine/_endian.h(28): error C2085: '__ntohl': not in formal parameter list
    C:\msys64\usr\include\machine/_endian.h(28): error C2143: syntax error: missing ';' before '{'
    C:\msys64\usr\include\machine/_endian.h(34): error C2054: expected '(' to follow '__inline__'
    C:\msys64\usr\include\machine/_endian.h(35): error C2085: '__ntohs': not in formal parameter list
    C:\msys64\usr\include\machine/_endian.h(35): error C2143: syntax error: missing ';' before '{'
    C:\msys64\usr\include\sys/_timeval.h(35): error C2061: syntax error: identifier 'suseconds_t'
    C:\msys64\usr\include\sys/_timeval.h(35): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/_timeval.h(54): error C2061: syntax error: identifier 'suseconds_t'
    C:\msys64\usr\include\sys/_timeval.h(55): error C2059: syntax error: '}'
    C:\msys64\usr\include\sys/types.h(173): error C2061: syntax error: identifier 'off_t'
    C:\msys64\usr\include\sys/types.h(173): error C2059: syntax error: ';'
    C:\msys64\usr\include\sys/types.h(200): error C2054: expected '(' to follow '_ssize_t'
    C:\msys64\usr\include\sys/types.h(205): error C2085: 'mode_t': not in formal parameter list
    C:\msys64\usr\include\sys/types.h(210): error C2085: '__nlink_t': not in formal parameter list
    C:\msys64\usr\include\sys/types.h(210): error C2146: syntax error: missing ',' before identifier 'nlink_t'
    C:\msys64\usr\include\sys/types.h(215): error C2085: '__clockid_t': not in formal parameter list
    C:\msys64\usr\include\sys/types.h(215): error C2146: syntax error: missing ',' before identifier 'clockid_t'
    C:\msys64\usr\include\sys/types.h(221): error C2085: '__timer_t': not in formal parameter list
    C:\msys64\usr\include\sys/types.h(221): error C2146: syntax error: missing ',' before identifier 'timer_t'
    C:\msys64\usr\include\sys/types.h(227): error C2085: '__useconds_t': not in formal parameter list
    C:\msys64\usr\include\sys/types.h(227): error C2146: syntax error: missing ',' before identifier 'useconds_t'
    C:\msys64\usr\include\sys/types.h(236): error C2085: 'sbintime_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(15): error C2085: 'pthread_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(16): error C2085: 'pthread_mutex_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(18): error C2085: 'pthread_key_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(19): error C2085: 'pthread_attr_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(20): error C2085: 'pthread_mutexattr_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(21): error C2085: 'pthread_condattr_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(22): error C2085: 'pthread_cond_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(23): error C2085: 'pthread_barrierattr_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(24): error C2085: 'pthread_barrier_t': not in formal parameter list
    C:\msys64\usr\include\sys/_pthreadtypes.h(29): error C2061: syntax error: identifier 'pthread_mutex_t'
    C:\msys64\usr\include\sys/_pthreadtypes.h(31): error C2059: syntax error: '}'
    C:\msys64\usr\include\machine/types.h(33): error C2061: syntax error: identifier 'loff_t'
    C:\msys64\usr\include\machine/types.h(33): fatal error C1003: error count exceeds 100; stopping compilation
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\USERNAME\\AppData\\Local\\Temp\\pip-install-2hfg5bx5\\postal\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext -IC:\msys64\usr\include -LC:\Users\USERNAME\Source\Repos\libpostal install --record C:\Users\USERNAME\AppData\Local\Temp\pip-record-1wkizbh2\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\USERNAME\AppData\Local\Temp\pip-install-2hfg5bx5\postal\

coldacid avatar Sep 11 '18 21:09 coldacid

@batterseapower I am facing the same error like @coldacid

error.txt

anantsaraswat avatar Sep 12 '18 12:09 anantsaraswat

@anantsaraswat @coldacid you are right, there was an issue with the instructions. Can you try the version in #39? I just tested them and they work.

batterseapower avatar Oct 13 '18 18:10 batterseapower

@batterseapower Thanks a lot for the update, I can confirm it's working fine after your changes in the readme file.

Also, it's worth mentioning in Readme that we need to replace the libpostal.def with the https://raw.githubusercontent.com/openvenues/libpostal/216c947e37cd3d885b2a29b5b330406b7df739a4/libpostal.def

@coldacid - Now we can use pypostal on windows :+1:

anantsaraswat avatar Nov 01 '18 20:11 anantsaraswat

I'm facing the same error as @jnbaene. How should I fix this?

abizerjafferjee avatar Nov 08 '18 05:11 abizerjafferjee

@abizerjafferjee I don't think you should get that error if you follow my instructions. Are doing that?

batterseapower avatar Nov 08 '18 18:11 batterseapower

@batterseapower I want to try these instructions from your update of the readme file:

mkdir headers && cp -r /usr/include/libpostal/ headers/

lib.exe /def:libpostal.def /out:postal.lib /machine:x64 pip install postal --global-option=build_ext --global-option="-I[...libpostal checkout...]\headers" --global-option="-L[...libpostal checkout...]" copy src.libs\libpostal-1.dll "C:\Python36\Lib\site-packages\postal\libpostal.dll"

But I don't have any directory called /usr/include/libpostal/ so I'm not sure how to continue. Your help will be appreciated.

abizerjafferjee avatar Nov 09 '18 14:11 abizerjafferjee

@batterseapower @anantsaraswat Trying this on my Windows machine I followed every step of your instructions and also #39 I also happen to successfully pip install postal ... into my python environment. However, I could not find the libpostal-1.dll file in the location src\.libs\ after I ran make commands. Any reason why this could happen ? I did not get any errors apart from some warnings.

The only other dll file in that location was msys-postal-1.dll which I'm guessing is not the same as libpostal-1.dll.

Any help is appreciated.

Thanks !

  • Mohammed Ayub

mohammedayub44 avatar Feb 09 '19 07:02 mohammedayub44

@batterseapower I want to try these instructions from your update of the readme file:

mkdir headers && cp -r /usr/include/libpostal/ headers/

lib.exe /def:libpostal.def /out:postal.lib /machine:x64 pip install postal --global-option=build_ext --global-option="-I[...libpostal checkout...]\headers" --global-option="-L[...libpostal checkout...]" copy src.libs\libpostal-1.dll "C:\Python36\Lib\site-packages\postal\libpostal.dll"

But I don't have any directory called /usr/include/libpostal/ so I'm not sure how to continue. Your help will be appreciated.

@abizerjafferjee Hi there. I just managed to pip install the thing after running into the same problem. For me the header-file was located in /mingw64/include/libpostal

JojoThePolarBear avatar Feb 22 '19 14:02 JojoThePolarBear

Hi guys, @batterseapower I have followed your #39 instructions through however when I run pip from within the x64 Native Tools Command Prompt for VS 2019 I get a 'pip is not recognized as an internal or external command'

Any suggestions on getting over this final hurdle? Cheers!

AdamButlerMudano avatar Jun 04 '19 12:06 AdamButlerMudano

@AdamButlerMudano I am just jumping into this discussion. Have you tried this: https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-command I am going to try and get it working in windows myself.

ShaneRyan1977 avatar Jun 24 '19 18:06 ShaneRyan1977

@AdamButlerMudano I did not have pip in my path. Instead I called it explicitly by it's location.

So something like this: c:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts\pip.exe" install postal --global-option=build_ext --global-option="-IC:\msys64\home\JoJoThePolarBear\libpostal\headers" --global-option="-LC:\msys64\home\JoJoThePolarBear\libpostal"

JojoThePolarBear avatar Jun 26 '19 14:06 JojoThePolarBear

Hey @batterseapower. First of all, thanks for the solution, I have been trying to install postal package in Python for 3 days and this is the furthest I've got. Still, I just used your solution and followed all instructions, but when I try to pip install using x64 Native Tools Command Prompt for VS 2019 I get an error message: error.txt

Any clue what this means?

luisscabral avatar Jul 06 '19 14:07 luisscabral

Also, it's worth mentioning in Readme that we need to replace the libpostal.def with the https://raw.githubusercontent.com/openvenues/libpostal/216c947e37cd3d885b2a29b5b330406b7df739a4/libpostal.def

Absolutely, this was the last missing piece!

Otherwise unresolved symbols during linking:

pyexpand.obj : error LNK2001: unresolved external symbol "__imp_libpostal_expand_address_root".

w0pr avatar Aug 07 '19 16:08 w0pr

@luisscabral

Any clue what this means?

pyexpand.obj : error LNK2001: unresolved external symbol __imp__libpostal_setup
pyexpand.obj : error LNK2001: unresolved external symbol __imp__libpostal_setup_language_classifier
pyexpand.obj : error LNK2001: unresolved external symbol __imp__libpostal_teardown_language_classifier
pyexpand.obj : error LNK2001: unresolved external symbol __imp__libpostal_get_default_options
pyexpand.obj : error LNK2001: unresolved external symbol __imp__libpostal_expansion_array_destroy
pyexpand.obj : error LNK2001: unresolved external symbol __imp__libpostal_expand_address
pyexpand.obj : error LNK2001: unresolved external symbol __imp__libpostal_teardown
build\lib.win32-3.7\postal\_expand.cp37-win32.pyd : fatal error LNK1120: 7 unresolved externals

see my comment above, you need to replace libportal.def and run

lib.exe /def:libpostal.def /out:postal.lib /machine:x64

again before pip install

w0pr avatar Aug 07 '19 16:08 w0pr

When trying to run the second last command as per @batterseapower "installing libpostal on Windows" instructions >C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Scripts\pip.exe install postal --global-option=build_ext --global-option="-IC:\msys64\home\Administrator\libpostal\headers" --global-option="-LC:\msys64\home\Administrator\libpostal" I get the error:

LINK : fatal error LNK1181: cannot open input file 'postal.lib' error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\link.exe' failed with exit status 1181

I've noticed this was the same error in issue #23 and tried @w0pr suggestions but still got the error.

Here’s what I’ve done so far: Windows Server 2016 (version 1607 OS Build 14393.3474) Python 3.8.1 Followed these instructions:

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=[...some dir with a few GB of space...]
make
make install
mkdir headers && cp -r /mingw64/include/libpostal/ headers/

I then replace the contents of the libpostal.def with the updated exports.

To get the “x64 Native tools Command Prompt for VS 2019” I go to: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017 Partway down the page is “Tools for Visual Studio 2019” accordion I download: Build Tools for Visual Studio 2019

Once installed, from the start menu i run “x64 Native tools Command Prompt for VS 2019” CD into C:\msys64\home\Administrator\libpostal

I then create the libpostal.lib and libpostal.exp files > "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\Hostx86\x64\lib.exe" /def:libpostal.def /out:libpostal.lib /machine:x64

I then try to install postal > C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Scripts\pip.exe install postal --global-option=build_ext --global-option="-IC:\msys64\home\Administrator\libpostal\headers" --global-option="-LC:\msys64\home\Administrator\libpostal" And here is the full error

C:\msys64\home\Administrator\libpostal>C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Scripts\pip.exe install postal --global-option=build_ext --global-option="-IC:\msys64\home\Administrator\libpostal\headers" --global-option="-LC:\msys64\home\Administrator\libpostal"
c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\install.py:243: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
  cmdoptions.check_install_build_global(options)
Collecting postal
  Using cached https://files.pythonhosted.org/packages/56/f7/69ca5d374077e23aa9a51ecd4031222ca9dfb7d19c95d7691f024e2e27ef/postal-1.1.8.tar.gz
Requirement already satisfied: six in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from postal) (1.14.0)
Installing collected packages: postal
  Running setup.py install for postal ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\administrator\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\2\\pip-install-uko68fs7\\postal\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\2\\pip-install-uko68fs7\\postal\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\msys64\home\Administrator\libpostal\headers' '-LC:\msys64\home\Administrator\libpostal' install --record 'C:\Users\Administrator\AppData\Local\Temp\2\pip-record-bsnzc5rn\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Administrator\AppData\Local\Temp\2\pip-install-uko68fs7\postal\
    Complete output (20 lines):
    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\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\msys64\home\Administrator\libpostal\headers -Ic:\users\administrator\appdata\local\programs\python\python38\include -Ic:\users\administrator\appdata\local\programs\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.8\Release\postal/pyexpand.obj -std=c99
    cl : Command line warning D9002 : ignoring unknown option '-std=c99'
    pyexpand.c
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\msys64\home\Administrator\libpostal\headers -Ic:\users\administrator\appdata\local\programs\python\python38\include -Ic:\users\administrator\appdata\local\programs\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcpostal/pyutils.c /Fobuild\temp.win-amd64-3.8\Release\postal/pyutils.obj -std=c99
    cl : Command line warning D9002 : ignoring unknown option '-std=c99'
    pyutils.c
    postal/pyutils.c(41): warning C4090: 'initializing': different 'const' qualifiers
    postal/pyutils.c(99): warning C4018: '>=': signed/unsigned mismatch
    postal/pyutils.c(123): warning C4018: '<': signed/unsigned mismatch
    creating C:\Users\Administrator\AppData\Local\Temp\2\pip-install-uko68fs7\postal\build\lib.win-amd64-3.8
    creating C:\Users\Administrator\AppData\Local\Temp\2\pip-install-uko68fs7\postal\build\lib.win-amd64-3.8\postal
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:/usr/local/lib /LIBPATH:C:\msys64\home\Administrator\libpostal /LIBPATH:c:\users\administrator\appdata\local\programs\python\python38\libs /LIBPATH:c:\users\administrator\appdata\local\programs\python\python38\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" postal.lib /EXPORT:PyInit__expand build\temp.win-amd64-3.8\Release\postal/pyexpand.obj build\temp.win-amd64-3.8\Release\postal/pyutils.obj /OUT:build\lib.win-amd64-3.8\postal\_expand.cp38-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.8\Release\postal\_expand.cp38-win_amd64.lib
    LINK : fatal error LNK1181: cannot open input file 'postal.lib'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\administrator\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\2\\pip-install-uko68fs7\\postal\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\2\\pip-install-uko68fs7\\postal\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\msys64\home\Administrator\libpostal\headers' '-LC:\msys64\home\Administrator\libpostal' install --record 'C:\Users\Administrator\AppData\Local\Temp\2\pip-record-bsnzc5rn\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Random thing I also tried was to put the libpostal.lib and the libpostal.h (from headers/libpostal) into the C:\Users\Administrator\AppData\Local\Programs\Python\Python38\libs and C:\Users\Administrator\AppData\Local\Programs\Python\Python38\include folders respectively.

I’m feeling really stuck and and would really appreciate any help I can get :)

pboutet avatar Feb 29 '20 03:02 pboutet

I then create the libpostal.lib and libpostal.exp files > "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\Hostx86\x64\lib.exe" /def:libpostal.def /out:libpostal.lib /machine:x64

And here is the full error

LINK : fatal error LNK1181: cannot open input file 'postal.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181

I’m feeling really stuck and and would really appreciate any help I can get :)

You need to create "postal.lib", not "libpostal.lib".

w0pr avatar Feb 29 '20 07:02 w0pr

You need to create "postal.lib", not "libpostal.lib".

You know sometimes when you stare at a problem for so long you just become blind to the answer that's been in front of you the WHOLE TIME......

Thank you for showing me the way @w0pr I literally can't thank you enough!

pboutet avatar Feb 29 '20 17:02 pboutet

Everything seemed fine regarding putting the first steps.

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/dev/libpostal
make
make install
cp -r /c/msys64/mingw64/include/ headers/

Replaced libpostal.def

Used x64 Native tools Command Prompt for VS 2019 > "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x64\lib.exe" /def:libpostal.def /out:postal.lib /machine:x64

>C:\Users\jgwin10\AppData\Local\Programs\Python\Python39\Scripts\pip.exe install postal --global-option=build_ext --global-option="-IC:\msys64\home\jgwin10\libpostal\headers" --global-option="-LC:\msys64\home\jgwin10\libpostal"

Still unable to get it working.

cl : Command line warning D9002 : ignoring unknown option '-std=c99' pyexpand.c postal/pyexpand.c(2): fatal error C1083: Cannot open include file: 'libpostal/libpostal.h': No such file or directory

Thank you @pboutet for documenting your flow.

goodwince avatar Sep 27 '21 15:09 goodwince

It still an issue in 2022. I followed everything based on latest README and flow @pboutet mentioned with no success.

@jnbaene @goodwince - were you able to get it to work at all? I am getting similar error.

patel-parth avatar Aug 25 '22 16:08 patel-parth