pypostal icon indicating copy to clipboard operation
pypostal copied to clipboard

Do I have to install the C library on Mac?

Open pengyu opened this issue 6 years ago • 4 comments

I got the following error when I directly run pip install postal on Mac.

Do I have to manually install the C library? I'd rather not to manually install packages on Mac. Is there a way to make the installation automatic with either include the C library installation in pip or include it in homebrew?

$ 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 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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 /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-install-guQ8Tb/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 /private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-wheel-cO252B --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-2.7
  creating build/lib.macosx-10.9-x86_64-2.7/postal
  copying postal/token_types.py -> build/lib.macosx-10.9-x86_64-2.7/postal
  copying postal/dedupe.py -> build/lib.macosx-10.9-x86_64-2.7/postal
  copying postal/normalize.py -> build/lib.macosx-10.9-x86_64-2.7/postal
  copying postal/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/postal
  copying postal/parser.py -> build/lib.macosx-10.9-x86_64-2.7/postal
  copying postal/near_dupe.py -> build/lib.macosx-10.9-x86_64-2.7/postal
  copying postal/tokenize.py -> build/lib.macosx-10.9-x86_64-2.7/postal
  copying postal/expand.py -> build/lib.macosx-10.9-x86_64-2.7/postal
  creating build/lib.macosx-10.9-x86_64-2.7/postal/tests
  copying postal/tests/test_parser.py -> build/lib.macosx-10.9-x86_64-2.7/postal/tests
  copying postal/tests/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/postal/tests
  copying postal/tests/test_expand.py -> build/lib.macosx-10.9-x86_64-2.7/postal/tests
  copying postal/tests/test_near_dupes.py -> build/lib.macosx-10.9-x86_64-2.7/postal/tests
  creating build/lib.macosx-10.9-x86_64-2.7/postal/utils
  copying postal/utils/encoding.py -> build/lib.macosx-10.9-x86_64-2.7/postal/utils
  copying postal/utils/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/postal/utils
  copying postal/utils/omitted.py -> build/lib.macosx-10.9-x86_64-2.7/postal/utils
  copying postal/utils/enum.py -> build/lib.macosx-10.9-x86_64-2.7/postal/utils
  copying postal/pyutils.h -> build/lib.macosx-10.9-x86_64-2.7/postal
  running build_ext
  building 'postal._expand' extension
  creating build/temp.macosx-10.9-x86_64-2.7
  creating build/temp.macosx-10.9-x86_64-2.7/postal
  gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c postal/pyexpand.c -o build/temp.macosx-10.9-x86_64-2.7/postal/pyexpand.o -std=c99
  postal/pyexpand.c:2:10: fatal error: 'libpostal/libpostal.h' file not found
  #include <libpostal/libpostal.h>
           ^~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  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 /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-install-guQ8Tb/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 /private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-record-0EXPw6/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-2.7
    creating build/lib.macosx-10.9-x86_64-2.7/postal
    copying postal/token_types.py -> build/lib.macosx-10.9-x86_64-2.7/postal
    copying postal/dedupe.py -> build/lib.macosx-10.9-x86_64-2.7/postal
    copying postal/normalize.py -> build/lib.macosx-10.9-x86_64-2.7/postal
    copying postal/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/postal
    copying postal/parser.py -> build/lib.macosx-10.9-x86_64-2.7/postal
    copying postal/near_dupe.py -> build/lib.macosx-10.9-x86_64-2.7/postal
    copying postal/tokenize.py -> build/lib.macosx-10.9-x86_64-2.7/postal
    copying postal/expand.py -> build/lib.macosx-10.9-x86_64-2.7/postal
    creating build/lib.macosx-10.9-x86_64-2.7/postal/tests
    copying postal/tests/test_parser.py -> build/lib.macosx-10.9-x86_64-2.7/postal/tests
    copying postal/tests/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/postal/tests
    copying postal/tests/test_expand.py -> build/lib.macosx-10.9-x86_64-2.7/postal/tests
    copying postal/tests/test_near_dupes.py -> build/lib.macosx-10.9-x86_64-2.7/postal/tests
    creating build/lib.macosx-10.9-x86_64-2.7/postal/utils
    copying postal/utils/encoding.py -> build/lib.macosx-10.9-x86_64-2.7/postal/utils
    copying postal/utils/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/postal/utils
    copying postal/utils/omitted.py -> build/lib.macosx-10.9-x86_64-2.7/postal/utils
    copying postal/utils/enum.py -> build/lib.macosx-10.9-x86_64-2.7/postal/utils
    copying postal/pyutils.h -> build/lib.macosx-10.9-x86_64-2.7/postal
    running build_ext
    building 'postal._expand' extension
    creating build/temp.macosx-10.9-x86_64-2.7
    creating build/temp.macosx-10.9-x86_64-2.7/postal
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c postal/pyexpand.c -o build/temp.macosx-10.9-x86_64-2.7/postal/pyexpand.o -std=c99
    postal/pyexpand.c:2:10: fatal error: 'libpostal/libpostal.h' file not found
    #include <libpostal/libpostal.h>
             ^~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-install-guQ8Tb/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 /private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-record-0EXPw6/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/pip-install-guQ8Tb/postal/

pengyu avatar Sep 12 '18 21:09 pengyu

For now, you need to install it.

I used the following link as the normal instructions didn't work.

https://github.com/openvenues/libpostal/issues/310

nyejon avatar Oct 30 '18 08:10 nyejon

I had the same issue you just need to make sure that the libpostal is installed on your mac: (use the following command and make sure to specify the directory after the "./configure --datadir=" command. Ignore the square bracket and make sure to run the make/sudo make install right after this step as this step will take some time to run

git clone https://github.com/openvenues/libpostal cd libpostal ./bootstrap.sh ./configure --datadir=[...some dir with a few GB of space...] make sudo make install

schen57 avatar Jan 27 '19 16:01 schen57

Unable to install the libpostal library. I got the following error when following your instructions.

/Library/Developer/CommandLineTools/usr/bin/make all-recursive Making all in src gcc -DHAVE_CONFIG_H -I.. -I/usr/local/include -Wall -Wextra -Wno-unused-function -Wformat -Werror=format-security -Winit-self -Wno-sign-compare -DLIBPOSTAL_DATA_DIR='"/Users/someshgupta/libpostal/s_folder/libpostal"' -g -mfpmath=sse -msse2 -DUSE_SSE -g -O2 -O3 -MT libpostal-strndup.o -MD -MP -MF .deps/libpostal-strndup.Tpo -c -o libpostal-strndup.o test -f 'strndup.c' || echo './'strndup.c clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument] error: unknown FP unit 'sse' make[2]: *** [libpostal-strndup.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2

what should I do to install it?

somesh636 avatar Apr 02 '21 15:04 somesh636

The libpostal repo has an additional instruction for mac:

If you're using an M1 Mac, add --disable-sse2 to the ./configure command. This will result in poorer performance but the build will succeed.

Did solve my problem

ycouble avatar Mar 25 '24 14:03 ycouble