kakao / n2

TOROS N2 - lightweight approximate Nearest Neighbor library which runs fast even with large datasets
Apache License 2.0
567 stars 71 forks source link

Can't install into Conda environment on macOS Big Sur #37

Closed jobha closed 3 years ago

jobha commented 3 years ago

I am getting this when I try to install n2 in a condo environment on macOS 11.0.1.

(Standard) jobha@macbook-pro ~ % pip install n2
Defaulting to user installation because normal site-packages is not writeable
Collecting n2
  Using cached n2-0.1.7.tar.gz (8.6 MB)
Requirement already satisfied: cython in ./Library/Python/3.8/lib/python/site-packages (from n2) (0.29.21)
Building wheels for collected packages: n2
  Building wheel for n2 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"'; __file__='"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/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/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-wheel-yyl4o763
       cwd: /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/
  Complete output (17 lines):
  running bdist_wheel
  running build
  running build_ext
  cythoning ./bindings/python/n2.pyx to ./bindings/python/n2.cpp
  /Users/jobha/Library/Python/3.8/lib/python/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/bindings/python/n2.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'n2' extension
  creating build
  creating build/temp.macosx-10.14.6-x86_64-3.8
  creating build/temp.macosx-10.14.6-x86_64-3.8/src
  creating build/temp.macosx-10.14.6-x86_64-3.8/bindings
  creating build/temp.macosx-10.14.6-x86_64-3.8/bindings/python
  /usr/local/opt/gcc/bin/gcc-10 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I./include/ -I./third_party/spdlog/include/ -I./third_party/eigen -Ithird_party/boost/assert/include/ -Ithird_party/boost/bind/include/ -Ithird_party/boost/concept_check/include/ -Ithird_party/boost/config/include/ -Ithird_party/boost/core/include/ -Ithird_party/boost/detail/include/ -Ithird_party/boost/heap/include/ -Ithird_party/boost/iterator/include/ -Ithird_party/boost/mp11/include/ -Ithird_party/boost/mpl/include/ -Ithird_party/boost/parameter/include/ -Ithird_party/boost/preprocessor/include/ -Ithird_party/boost/static_assert/include/ -Ithird_party/boost/throw_exception/include/ -Ithird_party/boost/type_traits/include/ -Ithird_party/boost/utility/include/ -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c ./src/heuristic.cc -o build/temp.macosx-10.14.6-x86_64-3.8/./src/heuristic.o -std=c++14 -O3 -fPIC -march=native -DNDEBUG -DBOOST_DISABLE_ASSERTS -fopenmp
  gcc-10: error: this compiler does not support arm64
  gcc-10: error: unrecognized command-line option '-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders'
  gcc-10: error: unrecognized command-line option '-iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers'
  error: command '/usr/local/opt/gcc/bin/gcc-10' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for n2
  Running setup.py clean for n2
Failed to build n2
Installing collected packages: n2
    Running setup.py install for n2 ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"'; __file__='"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/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/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-record-7pd04cpp/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/jobha/Library/Python/3.8/include/python3.8/n2
         cwd: /private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/
    Complete output (15 lines):
    running install
    running build
    running build_ext
    skipping './bindings/python/n2.cpp' Cython extension (up-to-date)
    building 'n2' extension
    creating build
    creating build/temp.macosx-10.14.6-x86_64-3.8
    creating build/temp.macosx-10.14.6-x86_64-3.8/src
    creating build/temp.macosx-10.14.6-x86_64-3.8/bindings
    creating build/temp.macosx-10.14.6-x86_64-3.8/bindings/python
    /usr/local/opt/gcc/bin/gcc-10 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I./include/ -I./third_party/spdlog/include/ -I./third_party/eigen -Ithird_party/boost/assert/include/ -Ithird_party/boost/bind/include/ -Ithird_party/boost/concept_check/include/ -Ithird_party/boost/config/include/ -Ithird_party/boost/core/include/ -Ithird_party/boost/detail/include/ -Ithird_party/boost/heap/include/ -Ithird_party/boost/iterator/include/ -Ithird_party/boost/mp11/include/ -Ithird_party/boost/mpl/include/ -Ithird_party/boost/parameter/include/ -Ithird_party/boost/preprocessor/include/ -Ithird_party/boost/static_assert/include/ -Ithird_party/boost/throw_exception/include/ -Ithird_party/boost/type_traits/include/ -Ithird_party/boost/utility/include/ -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c ./src/heuristic.cc -o build/temp.macosx-10.14.6-x86_64-3.8/./src/heuristic.o -std=c++14 -O3 -fPIC -march=native -DNDEBUG -DBOOST_DISABLE_ASSERTS -fopenmp
    gcc-10: error: this compiler does not support arm64
    gcc-10: error: unrecognized command-line option '-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders'
    gcc-10: error: unrecognized command-line option '-iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers'
    error: command '/usr/local/opt/gcc/bin/gcc-10' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/setup.py'"'"'; __file__='"'"'/private/var/folders/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-install-mezncx0r/n2_f8e0f60d4ce7478a8a9ff2fc75baf2f1/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/ks/41yvq4xs6lz93w93lqvgwp840000gn/T/pip-record-7pd04cpp/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/jobha/Library/Python/3.8/include/python3.8/n2 Check the logs for full command output.
gony-noreply commented 3 years ago

Check python3-config --includes. If the output value starts with -iwithsysroot that option seems to be for xcode clang. gcc couldn't understand that option, so compile during install was failed.

One possible way is to use python installed with brew. When python is installed with brew, relevant headers are installed and gcc can understand python3-config --includes result.