-
Notifications
You must be signed in to change notification settings - Fork 89
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
Comments
I have the c++ 14.0 already installed and is working perfectly for other installations like implicit and stuff. |
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 |
I am not sure how? Is there any timelines as to when will I able to install it on my windows machine? |
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. |
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. 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 -> 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 |
Oh, it should be 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). |
Hi @albarrentine, That was stupid on my part. However I've cloned AeroXuk:master, but again I get this error: 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? |
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. |
Hi @albarrentine , I found your work and been trying to use it Nevertheless, once I try to use the pip install postal instruction I still get the error: Failed building wheel for postal
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 sorry for the inconvenience |
@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:
|
@batterseapower I am facing the same error like @coldacid |
@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 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 👍 |
I'm facing the same error as @jnbaene. How should I fix this? |
@abizerjafferjee I don't think you should get that error if you follow my instructions. Are doing that? |
@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 But I don't have any directory called /usr/include/libpostal/ so I'm not sure how to continue. |
@batterseapower @anantsaraswat Trying this on my Windows machine I followed every step of your instructions and also #39 The only other dll file in that location was Any help is appreciated. Thanks !
|
@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 |
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? |
@AdamButlerMudano I am just jumping into this discussion. Have you tried this: |
@AdamButlerMudano I did not have pip in my path. Instead I called it explicitly by it's location. So something like this: |
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. Any clue what this means? |
Absolutely, this was the last missing piece! Otherwise unresolved symbols during linking:
|
see my comment above, you need to replace libportal.def and run
again before |
When trying to run the second last command as per @batterseapower "installing libpostal on Windows" instructions
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:
I then replace the contents of the libpostal.def with the updated exports. To get the “x64 Native tools Command Prompt for VS 2019” Once installed, from the start menu i run “x64 Native tools Command Prompt for VS 2019” I then create the libpostal.lib and libpostal.exp files I then try to install postal
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 :) |
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! |
Everything seemed fine regarding putting the first steps.
Replaced libpostal.def Used x64 Native tools Command Prompt for VS 2019
Still unable to get it working.
Thank you @pboutet for documenting your flow. |
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. |
Following steps from @pboutet and @goodwince I didn't get the error
|
Am also hitting the exact same issue |
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:
and then run the following:
but i have this error:
Can anyone help me? |
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). pyneardupe.obj : error LNK2001: unresolved external symbol __imp_libpostal_near_dupe_name_hashes - still have no need and ideas how to fix that |
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\
The text was updated successfully, but these errors were encountered: