1

Runing the command in the instruction:

pip install -U spacy

It fails to build wheel for Building wheels for collected packages: spacy, murmurhash, cymem, preshed, thinc, ujson, regex, cytoolz

This is the error shown on the terminal.

  Running setup.py bdist_wheel for spacy ... error
  Complete output from command /usr/local/opt/python/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/spacy/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/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-wheel-swjw2gll --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-x86_64-3.6
  creating build/lib.macosx-10.13-x86_64-3.6/spacy
  copying spacy/lemmatizer.py -> build/lib.macosx-10.13-x86_64-3.6/spacy
  copying spacy/compat.py -> build/lib.macosx-10.13-x86_64-3.6/spacy
  ...
  ...
    copying spacy/tests/tokenizer/sun.txt -> build/lib.macosx-10.13-x86_64-3.6/spacy/tests/tokenizer
  running build_ext
  building 'spacy.parts_of_speech' extension
  creating build/temp.macosx-10.13-x86_64-3.6
  creating build/temp.macosx-10.13-x86_64-3.6/spacy
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /usr/local/opt/openssl/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/spacy/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c spacy/parts_of_speech.cpp -o build/temp.macosx-10.13-x86_64-3.6/spacy/parts_of_speech.o -O2 -Wno-strict-prototypes -Wno-unused-function
  clang: warning: /usr/local/opt/openssl/include: 'linker' input unused [-Wunused-command-line-argument]
  clang++ -bundle -undefined dynamic_lookup /usr/local/opt/openssl/lib /usr/local/opt/openssl/include build/temp.macosx-10.13-x86_64-3.6/spacy/parts_of_speech.o -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -o build/lib.macosx-10.13-x86_64-3.6/spacy/parts_of_speech.cpython-36m-darwin.so -Wl,-rpath,@loader_path/../spacy/platform/darwin/lib
  ld: can't map file, errno=22 file '/usr/local/opt/openssl/include' for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'clang++' failed with exit status 1

  ----------------------------------------
  Failed building wheel for spacy
  Running setup.py clean for spacy
  Running setup.py bdist_wheel for murmurhash ... error
  Complete output from command /usr/local/opt/python/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/murmurhash/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/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-wheel-9ytvwkua --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-x86_64-3.6
  creating build/lib.macosx-10.13-x86_64-3.6/murmurhash
  copying murmurhash/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  copying murmurhash/about.py -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  creating build/lib.macosx-10.13-x86_64-3.6/murmurhash/tests
  copying murmurhash/tests/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/murmurhash/tests
  copying murmurhash/tests/test_import.py -> build/lib.macosx-10.13-x86_64-3.6/murmurhash/tests
  copying murmurhash/mrmr.pyx -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  copying murmurhash/__init__.pxd -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  copying murmurhash/mrmr.pxd -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  creating build/lib.macosx-10.13-x86_64-3.6/murmurhash/include
  creating build/lib.macosx-10.13-x86_64-3.6/murmurhash/include/murmurhash
  copying murmurhash/include/murmurhash/MurmurHash2.h -> build/lib.macosx-10.13-x86_64-3.6/murmurhash/include/murmurhash
  copying murmurhash/include/murmurhash/MurmurHash3.h -> build/lib.macosx-10.13-x86_64-3.6/murmurhash/include/murmurhash
  running build_ext
  building 'murmurhash.mrmr' extension
  creating build/temp.macosx-10.13-x86_64-3.6
  creating build/temp.macosx-10.13-x86_64-3.6/murmurhash
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /usr/local/opt/openssl/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/murmurhash/murmurhash/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c murmurhash/mrmr.cpp -o build/temp.macosx-10.13-x86_64-3.6/murmurhash/mrmr.o -O3 -Wno-strict-prototypes -Wno-unused-function
  clang: warning: /usr/local/opt/openssl/include: 'linker' input unused [-Wunused-command-line-argument]
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /usr/local/opt/openssl/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/murmurhash/murmurhash/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c murmurhash/MurmurHash2.cpp -o build/temp.macosx-10.13-x86_64-3.6/murmurhash/MurmurHash2.o -O3 -Wno-strict-prototypes -Wno-unused-function
  clang: warning: /usr/local/opt/openssl/include: 'linker' input unused [-Wunused-command-line-argument]
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /usr/local/opt/openssl/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/murmurhash/murmurhash/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c murmurhash/MurmurHash3.cpp -o build/temp.macosx-10.13-x86_64-3.6/murmurhash/MurmurHash3.o -O3 -Wno-strict-prototypes -Wno-unused-function
  clang: warning: /usr/local/opt/openssl/include: 'linker' input unused [-Wunused-command-line-argument]
  clang++ -bundle -undefined dynamic_lookup /usr/local/opt/openssl/lib /usr/local/opt/openssl/include build/temp.macosx-10.13-x86_64-3.6/murmurhash/mrmr.o build/temp.macosx-10.13-x86_64-3.6/murmurhash/MurmurHash2.o build/temp.macosx-10.13-x86_64-3.6/murmurhash/MurmurHash3.o -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -o build/lib.macosx-10.13-x86_64-3.6/murmurhash/mrmr.cpython-36m-darwin.so
  ld: can't map file, errno=22 file '/usr/local/opt/openssl/lib' for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'clang++' failed with exit status 1

  ----------------------------------------
  Failed building wheel for murmurhash
  Running setup.py clean for murmurhash

Similar error for the rest of the libraries.

It probably has something to do with finding python header files. And I checked the location using this command :

python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))"

/usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/include/python3.6m

It has all the header files.

This answer (Failed building wheel for spacy) suggests installing the wheel individually. How do I do that on Mac OS X?

vivekanon
  • 1,813
  • 3
  • 22
  • 44

1 Answers1

0

The best way to download Spacy and work with it is to download it manually and link it. Below command is used to download it and link it to your python libraries:

Command to download it:

pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz

Link that will explain more: https://spacy.io/usage/models#usage-link

Batman
  • 50
  • 8