allenai / scispacy

A full spaCy pipeline and models for scientific/biomedical documents.
https://allenai.github.io/scispacy/
Apache License 2.0
1.66k stars 223 forks source link

Unable to install scispacy on Macbook Pro M1 #497

Closed kaushaltaliun closed 9 months ago

kaushaltaliun commented 9 months ago

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/kaushalphulgirkar/miniconda/envs/snomed/include -arch arm64 -I/Users/kaushalphulgirkar/miniconda/envs/snomed/include -arch arm64 -I./similarity_search/include -Itensorflow -I/private/var/folders/tn/8nl4_8tj6l99zjs37zryj75c0000gn/T/pip-install-xkash56q/nmslib_be911ae35a5141bc88f0957dcf390b06/.eggs/pybind11-2.6.1-py3.8.egg/pybind11/include -I/private/var/folders/tn/8nl4_8tj6l99zjs37zryj75c0000gn/T/pip-install-xkash56q/nmslib_be911ae35a5141bc88f0957dcf390b06/.eggs/pybind11-2.6.1-py3.8.egg/pybind11/include -I/private/var/folders/tn/8nl4_8tj6l99zjs37zryj75c0000gn/T/pip-install-xkash56q/nmslib_be911ae35a5141bc88f0957dcf390b06/.eggs/pybind11-2.6.1-py3.8.egg/pybind11/include -I/private/var/folders/tn/8nl4_8tj6l99zjs37zryj75c0000gn/T/pip-install-xkash56q/nmslib_be911ae35a5141bc88f0957dcf390b06/.eggs/pybind11-2.6.1-py3.8.egg/pybind11/include -I/Users/kaushalphulgirkar/miniconda/envs/snomed/lib/python3.8/site-packages/numpy/core/include -I/Users/kaushalphulgirkar/miniconda/envs/snomed/include/python3.8 -c ./similarity_search/src/distcomp_scalar.cc -o build/temp.macosx-11.1-arm64-cpython-38/./similarity_search/src/distcomp_scalar.o -O3 -march=native -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO=\"2.1.1\" -std=c++14 -fvisibility=hidden ./similarity_search/src/distcomp_scalar.cc:85:9: error: pragma message requires parenthesized string

pragma message WARN("ScalarProductSIMD: SSE2 is not available, defaulting to pure C++ implementation!")

          ^
  ./similarity_search/src/distcomp_scalar.cc:169:18: warning: explicit instantiation of 'NormScalarProductSIMD<float>' that occurs after an explicit specialization has no effect [-Winstantiation-after-specialization]
  template float   NormScalarProductSIMD<float>(const float* pVect1, const float* pVect2, size_t qty);
                   ^
  ./similarity_search/src/distcomp_scalar.cc:83:7: note: previous template specialization is here
  float NormScalarProductSIMD(const float* pVect1, const float* pVect2, size_t qty) {
        ^
  ./similarity_search/src/distcomp_scalar.cc:195:9: error: pragma message requires parenthesized string
  #pragma message WARN("ScalarProductSIMD<float>: SSE2 is not available, defaulting to pure C++ implementation!")
          ^
  ./similarity_search/src/distcomp_scalar.cc:246:18: warning: explicit instantiation of 'ScalarProductSIMD<float>' that occurs after an explicit specialization has no effect [-Winstantiation-after-specialization]
  template float   ScalarProductSIMD<float>(const float* pVect1, const float* pVect2, size_t qty);
                   ^
  ./similarity_search/src/distcomp_scalar.cc:193:7: note: previous template specialization is here
  float ScalarProductSIMD(const float* pVect1, const float* pVect2, size_t qty) {
        ^
  2 warnings and 2 errors generated.
  error: command '/usr/bin/gcc' failed with exit code 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for nmslib Running setup.py clean for nmslib Failed to build nmslib ERROR: Could not build wheels for nmslib, which is required to install pyproject.toml-based projects

Mac Version: 14.0 (23A344) Python version: Python 3.8.18 Tried on 3.9, 3.10 and 3.11 as well. Using a miniconda env

mihogarth commented 9 months ago

a dependency of nmslib is the problem: https://github.com/nmslib/nmslib/issues/538


pip install --upgrade pybind11 # 2.10.1 or higher (latest as of today: 2.11.1) pip install --verbose 'nmslib @ git+https://github.com/nmslib/nmslib.git#egg=nmslib&subdirectory=python_bindings'

to make it run faster, do not use the --verbose flag.

kaushaltaliun commented 9 months ago

Was able to install this using this command: CFLAGS="-mavx -DWARN(a)=(a)" pip install nmslib

Reference: https://dev.to/adityakanekar/installing-scispacy-on-apple-m1-laptops-3cn6