Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't install it via pip on Windows #23

Open
ImCarrot opened this issue Nov 16, 2017 · 34 comments
Open

can't install it via pip on Windows #23

ImCarrot opened this issue Nov 16, 2017 · 34 comments

Comments

@ImCarrot
Copy link

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
Copy link
Author

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

@albarrentine
Copy link
Contributor

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.

@ImCarrot
Copy link
Author

ImCarrot commented Nov 25, 2017

@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?

@albarrentine
Copy link
Contributor

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 openvenues/libpostal#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.

@rouxrei
Copy link

rouxrei commented Jan 4, 2018

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 (openvenues/libpostal#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

@albarrentine
Copy link
Contributor

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).

@rouxrei
Copy link

rouxrei commented Jan 8, 2018

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?

@albarrentine albarrentine changed the title can't install it via pip can't install it via pip on Windows Jan 8, 2018
@albarrentine
Copy link
Contributor

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.

@jnbaene
Copy link

jnbaene commented Jun 28, 2018

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

@batterseapower
Copy link

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

@coldacid
Copy link

@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\

@anantsaraswat
Copy link

anantsaraswat commented Sep 12, 2018

@batterseapower I am facing the same error like @coldacid

error.txt

@batterseapower
Copy link

@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.

@anantsaraswat
Copy link

anantsaraswat commented Nov 1, 2018

@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 👍

@abizerjafferjee
Copy link

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

@batterseapower
Copy link

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

@abizerjafferjee
Copy link

@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.

@mohammedayub44
Copy link

@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

@JojoThePolarBear
Copy link

JojoThePolarBear commented Feb 22, 2019

@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

@AdamButlerMudano
Copy link

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!

@ShaneRyan1977
Copy link

@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.

@JojoThePolarBear
Copy link

@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"

@luisscabral
Copy link

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?

@w0pr
Copy link

w0pr commented Aug 7, 2019

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
Copy link

w0pr commented Aug 7, 2019

@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

@pboutet
Copy link

pboutet commented Feb 29, 2020

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 :)

@w0pr
Copy link

w0pr commented Feb 29, 2020

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".

@pboutet
Copy link

pboutet commented Feb 29, 2020

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!

@goodwince
Copy link

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.

@patel-parth
Copy link

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.

@ernestorefinepro
Copy link

ernestorefinepro commented Aug 30, 2022

Following steps from @pboutet and @goodwince I didn't get the error Cannot open include file: 'libpostal/libpostal.h': No such file or directory, instead I got this one:

C:\msys64\home\Home\libpostal>C:\Python310\Scripts\pip.exe install postal --global-option=build_ext --global-option="-IC:\msys64\home\Home\libpostal\headers" --global-option="-LC:\msys64\home\Home\libpostal"
WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
Collecting postal
  Using cached postal-1.1.10.tar.gz (21 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: six in c:\python310\lib\site-packages (from postal) (1.16.0)
Skipping wheel build for postal, due to binaries being disabled for it.
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)
Installing collected packages: postal
  Running setup.py install for postal ... error
  error: subprocess-exited-with-error

  × Running setup.py install for postal did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      C:\Python310\lib\site-packages\setuptools\dist.py:717: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      WARNING: The wheel package is not available.
      running build_ext
      building 'postal._expand' extension
      creating build
      creating build\temp.win-amd64-3.10
      creating build\temp.win-amd64-3.10\Release
      creating build\temp.win-amd64-3.10\Release\postal
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\msys64\home\Home\libpostal\headers -IC:\Python310\include -IC:\Python310\Include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.10\Release\postal/pyexpand.obj -std=c99
      cl : Command line warning D9002 : ignoring unknown option '-std=c99'
      pyexpand.c
      C:\Users\Home\AppData\Local\Temp\pip-install-zpwbv7n3\postal_c6a5241cd5204b2eba2ca1f4044009f9\postal\pyutils.h(14): error C2146: syntax error: missing ')' before identifier 'max_len'
      C:\Users\Home\AppData\Local\Temp\pip-install-zpwbv7n3\postal_c6a5241cd5204b2eba2ca1f4044009f9\postal\pyutils.h(14): error C2081: 'ssize_t': name in formal parameter list illegal
      C:\Users\Home\AppData\Local\Temp\pip-install-zpwbv7n3\postal_c6a5241cd5204b2eba2ca1f4044009f9\postal\pyutils.h(14): error C2061: syntax error: identifier 'max_len'
      C:\Users\Home\AppData\Local\Temp\pip-install-zpwbv7n3\postal_c6a5241cd5204b2eba2ca1f4044009f9\postal\pyutils.h(14): error C2059: syntax error: ';'
      C:\Users\Home\AppData\Local\Temp\pip-install-zpwbv7n3\postal_c6a5241cd5204b2eba2ca1f4044009f9\postal\pyutils.h(14): error C2059: syntax error: ','
      C:\Users\Home\AppData\Local\Temp\pip-install-zpwbv7n3\postal_c6a5241cd5204b2eba2ca1f4044009f9\postal\pyutils.h(14): error C2059: syntax error: ')'
      postal/pyexpand.c(130): warning C4013: 'PyObject_to_strings_max_len' undefined; assuming extern returning int
      postal/pyexpand.c(130): warning C4047: '=': 'char **' differs in levels of indirection from 'int'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> postal

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages)

@gnomechopsticks
Copy link

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.

Am also hitting the exact same issue

@maurizio-iannone-ey
Copy link

maurizio-iannone-ey commented May 25, 2023

Hi guys, I'm trying to install postal on python, I've already installed the libpostal C library following the Windows Instructions running on my MSYS minGW_64:

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 /usr/include/libpostal/ headers/

and then run the following:

lib.exe /def:libpostal.def /out:postal.lib /machine:x64
pip install postal --global-option=build_ext --global-option="-IC:\msys64\home\username\libpostal\headers" --global-option="-LC:\msys64\home\username\libpostal"
copy src\.libs\libpostal-1.dll "C:\Python36\Lib\site-packages\postal\libpostal.dll"

but i have this error:

error: subprocess-exited-with-error
  
  Running setup.py install for postal did not run successfully.
  exit code: 1
  
  [20 lines of output]
  C:\Users\LM628LZ\AppData\Local\anaconda3\lib\site-packages\setuptools\dist.py:770: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
    warnings.warn(
  running build_ext
  building 'postal._expand' extension
  creating build
  creating build\temp.win-amd64-cpython-310
  creating build\temp.win-amd64-cpython-310\Release
  creating build\temp.win-amd64-cpython-310\Release\postal
  "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\msys64\home\LM628LZ\libpostal\headers -IC:\Users\LM628LZ\AppData\Local\anaconda3\include -IC:\Users\LM628LZ\AppData\Local\anaconda3\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-cpython-310\Release\postal/pyexpand.obj -std=c99
  cl : Command line warning D9002 : ignoring unknown option '-std=c99'
  pyexpand.c
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2146: syntax error: missing ')' before identifier 'max_len'
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2081: 'ssize_t': name in formal parameter list illegal
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2061: syntax error: identifier 'max_len'
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2059: syntax error: ';'
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2059: syntax error: ','
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2059: syntax error: ')'
  postal/pyexpand.c(130): warning C4013: 'PyObject_to_strings_max_len' undefined; assuming extern returning int
  postal/pyexpand.c(130): warning C4047: '=': 'char **' differs in levels of indirection from 'int'
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

Encountered error while trying to install package.

postal

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Can anyone help me?
Thanks.

@DAud2219256
Copy link

Hi guys, I'm trying to install postal on python, I've already installed the libpostal C library following the Windows Instructions running on my MSYS minGW_64:

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 /usr/include/libpostal/ headers/

and then run the following:

lib.exe /def:libpostal.def /out:postal.lib /machine:x64
pip install postal --global-option=build_ext --global-option="-IC:\msys64\home\username\libpostal\headers" --global-option="-LC:\msys64\home\username\libpostal"
copy src\.libs\libpostal-1.dll "C:\Python36\Lib\site-packages\postal\libpostal.dll"

but i have this error:

error: subprocess-exited-with-error
  
  Running setup.py install for postal did not run successfully.
  exit code: 1
  
  [20 lines of output]
  C:\Users\LM628LZ\AppData\Local\anaconda3\lib\site-packages\setuptools\dist.py:770: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
    warnings.warn(
  running build_ext
  building 'postal._expand' extension
  creating build
  creating build\temp.win-amd64-cpython-310
  creating build\temp.win-amd64-cpython-310\Release
  creating build\temp.win-amd64-cpython-310\Release\postal
  "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\msys64\home\LM628LZ\libpostal\headers -IC:\Users\LM628LZ\AppData\Local\anaconda3\include -IC:\Users\LM628LZ\AppData\Local\anaconda3\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-cpython-310\Release\postal/pyexpand.obj -std=c99
  cl : Command line warning D9002 : ignoring unknown option '-std=c99'
  pyexpand.c
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2146: syntax error: missing ')' before identifier 'max_len'
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2081: 'ssize_t': name in formal parameter list illegal
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2061: syntax error: identifier 'max_len'
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2059: syntax error: ';'
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2059: syntax error: ','
  C:\Users\LM628LZ\AppData\Local\Temp\pip-install-qvvbpx19\postal_d9c0dabd9e86449fba9941b9daca4782\postal\pyutils.h(14): error C2059: syntax error: ')'
  postal/pyexpand.c(130): warning C4013: 'PyObject_to_strings_max_len' undefined; assuming extern returning int
  postal/pyexpand.c(130): warning C4047: '=': 'char **' differs in levels of indirection from 'int'
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

Encountered error while trying to install package.

postal

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Can anyone help me? Thanks.

Hi! I've managed to fix the generation for python3.11 of 6 of 7 (not _near_dupe.cp311-win_amd64) PYD files by manually replacing ssize_t type to int in code sources (in .h and relevant .c files - just follow the build output to find all places for replacement).
The way I've run that was just 'python setup.py build_ext --inplace' - not pip - with adding to include_dirs in setup.py path where my libpostal.h file is located.

pyneardupe.obj : error LNK2001: unresolved external symbol __imp_libpostal_near_dupe_name_hashes - still have no need and ideas how to fix that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests