Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue while installing Postal (Address Parser ) package of python

I am trying to install postal package using

pip install postal

I am following the steps mentioned in link https://github.com/openvenues/libpostal#installation-windows

I have installed Visual Studio 2019 C++ Build Tools, MSYS2 and performed the step

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 -j4
make install

Still I am not able to install postal package using pip install postal

Getting below logs while installing postal package.

(base) C:\Users\Praveen>pip install postal
Collecting postal
  Using cached https://files.pythonhosted.org/packages/56/f7/69ca5d374077e23aa9a51ecd4031222ca9dfb7d19c95d7691f024e2e27ef/postal-1.1.8.tar.gz
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from postal) (1.12.0)
Building wheels for collected packages: postal
  Building wheel for postal (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Praveen\\AppData\\Local\\Temp\\pip-install-9sens8xe\\postal\\setup.py'"'"'; __file__='"'"'C:\\Users\\Praveen\\AppData\\Local\\Temp\\pip-install-9sens8xe\\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\Praveen\AppData\Local\Temp\pip-wheel-e6vpt_0y' --python-tag cp37
       cwd: C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\
  Complete output (35 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\postal
  copying postal\dedupe.py -> build\lib.win-amd64-3.7\postal
  copying postal\expand.py -> build\lib.win-amd64-3.7\postal
  copying postal\near_dupe.py -> build\lib.win-amd64-3.7\postal
  copying postal\normalize.py -> build\lib.win-amd64-3.7\postal
  copying postal\parser.py -> build\lib.win-amd64-3.7\postal
  copying postal\tokenize.py -> build\lib.win-amd64-3.7\postal
  copying postal\token_types.py -> build\lib.win-amd64-3.7\postal
  copying postal\__init__.py -> build\lib.win-amd64-3.7\postal
  creating build\lib.win-amd64-3.7\postal\tests
  copying postal\tests\test_expand.py -> build\lib.win-amd64-3.7\postal\tests
  copying postal\tests\test_parser.py -> build\lib.win-amd64-3.7\postal\tests
  copying postal\tests\_test_near_dupes.py -> build\lib.win-amd64-3.7\postal\tests
  copying postal\tests\__init__.py -> build\lib.win-amd64-3.7\postal\tests
  creating build\lib.win-amd64-3.7\postal\utils
  copying postal\utils\encoding.py -> build\lib.win-amd64-3.7\postal\utils
  copying postal\utils\enum.py -> build\lib.win-amd64-3.7\postal\utils
  copying postal\utils\omitted.py -> build\lib.win-amd64-3.7\postal\utils
  copying postal\utils\__init__.py -> build\lib.win-amd64-3.7\postal\utils
  copying postal\pyutils.h -> build\lib.win-amd64-3.7\postal
  running build_ext
  building 'postal._expand' extension
  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\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.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
  postal/pyexpand.c(2): fatal error C1083: Cannot open include file: 'libpostal/libpostal.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.20.27508\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: 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
    ERROR: Command errored out with exit status 1:
     command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Praveen\\AppData\\Local\\Temp\\pip-install-9sens8xe\\postal\\setup.py'"'"'; __file__='"'"'C:\\Users\\Praveen\\AppData\\Local\\Temp\\pip-install-9sens8xe\\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\Praveen\AppData\Local\Temp\pip-record-k92kr5uk\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\
    Complete output (35 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\postal
    copying postal\dedupe.py -> build\lib.win-amd64-3.7\postal
    copying postal\expand.py -> build\lib.win-amd64-3.7\postal
    copying postal\near_dupe.py -> build\lib.win-amd64-3.7\postal
    copying postal\normalize.py -> build\lib.win-amd64-3.7\postal
    copying postal\parser.py -> build\lib.win-amd64-3.7\postal
    copying postal\tokenize.py -> build\lib.win-amd64-3.7\postal
    copying postal\token_types.py -> build\lib.win-amd64-3.7\postal
    copying postal\__init__.py -> build\lib.win-amd64-3.7\postal
    creating build\lib.win-amd64-3.7\postal\tests
    copying postal\tests\test_expand.py -> build\lib.win-amd64-3.7\postal\tests
    copying postal\tests\test_parser.py -> build\lib.win-amd64-3.7\postal\tests
    copying postal\tests\_test_near_dupes.py -> build\lib.win-amd64-3.7\postal\tests
    copying postal\tests\__init__.py -> build\lib.win-amd64-3.7\postal\tests
    creating build\lib.win-amd64-3.7\postal\utils
    copying postal\utils\encoding.py -> build\lib.win-amd64-3.7\postal\utils
    copying postal\utils\enum.py -> build\lib.win-amd64-3.7\postal\utils
    copying postal\utils\omitted.py -> build\lib.win-amd64-3.7\postal\utils
    copying postal\utils\__init__.py -> build\lib.win-amd64-3.7\postal\utils
    copying postal\pyutils.h -> build\lib.win-amd64-3.7\postal
    running build_ext
    building 'postal._expand' extension
    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\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.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
    postal/pyexpand.c(2): fatal error C1083: Cannot open include file: 'libpostal/libpostal.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.20.27508\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Praveen\\AppData\\Local\\Temp\\pip-install-9sens8xe\\postal\\setup.py'"'"'; __file__='"'"'C:\\Users\\Praveen\\AppData\\Local\\Temp\\pip-install-9sens8xe\\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\Praveen\AppData\Local\Temp\pip-record-k92kr5uk\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
like image 289
Kumar Avatar asked Oct 15 '22 07:10

Kumar


1 Answers

Try the following solution. I am running this in WSL.

Changes

  1. Navigate to cd~ directory before all commands.
  2. Use 'sudo' before make.
cd~
git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure
sudo make
sudo make install

Then run pip install postal

Also pip install nose prior to importing and running the postal library.

like image 108
user8851623 Avatar answered Oct 21 '22 07:10

user8851623