vioshyvo / mrpt

Fast and lightweight header-only C++ library (with Python bindings) for approximate nearest neighbor search
MIT License
257 stars 47 forks source link

unable to install on macos after brew install llvm #11

Open tony-tian opened 6 years ago

tony-tian commented 6 years ago

after brew install llvm worked fine, pip install git+https://github.com/teemupitkanen/mrpt/ meet some problems...hope for your help

  Running setup.py install for mrpt ... error
    Complete output from command /Users/tianyizhuang/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-zmys9ilr-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-7__rozak-record/install-record.txt --single-version-externally-managed --compile:
    WARNING: '.' not a valid package name; please use only .-separated package names in setup.py
    running install
    running build
    running build_py
    package init file '__init__.py' not found (or not a regular file)
    creating build
    creating build/lib.macosx-10.7-x86_64-3.6
    copying setup.py -> build/lib.macosx-10.7-x86_64-3.6
    copying mrpt.py -> build/lib.macosx-10.7-x86_64-3.6
    copying demo.py -> build/lib.macosx-10.7-x86_64-3.6
    running build_ext
    building 'mrptlib' extension
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/cpp
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/tianyizhuang/anaconda/include -arch x86_64 -I/Users/tianyizhuang/anaconda/include -arch x86_64 -Icpp/lib -I/Users/tianyizhuang/anaconda/lib/python3.6/site-packages/numpy/core/include -I/Users/tianyizhuang/anaconda/include/python3.6m -c cpp/mrptmodule.cpp -o build/temp.macosx-10.7-x86_64-3.6/cpp/mrptmodule.o -std=c++11 -O3 -ffast-math -s -fno-rtti -fopenmp -DNDEBUG -march=native
    clang: error: unsupported option '-fopenmp'
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Users/tianyizhuang/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-zmys9ilr-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-7__rozak-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-zmys9ilr-build/
ejaasaari commented 6 years ago

It seems that your compiler is defaulting to gcc. Try clang:

CC=clang CXX=clang++ pip install git+https://github.com/teemupitkanen/mrpt/

tony-tian commented 6 years ago

thanks for reply! the command still not worked..

  Running setup.py install for mrpt ... error
    Complete output from command /Users/tianyizhuang/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-1ligc2ie-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-z3mysqps-record/install-record.txt --single-version-externally-managed --compile:
    WARNING: '.' not a valid package name; please use only .-separated package names in setup.py
    running install
    running build
    running build_py
    package init file '__init__.py' not found (or not a regular file)
    creating build
    creating build/lib.macosx-10.7-x86_64-3.6
    copying setup.py -> build/lib.macosx-10.7-x86_64-3.6
    copying mrpt.py -> build/lib.macosx-10.7-x86_64-3.6
    copying demo.py -> build/lib.macosx-10.7-x86_64-3.6
    running build_ext
    building 'mrptlib' extension
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/cpp
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/tianyizhuang/anaconda/include -arch x86_64 -I/Users/tianyizhuang/anaconda/include -arch x86_64 -Icpp/lib -I/Users/tianyizhuang/anaconda/lib/python3.6/site-packages/numpy/core/include -I/Users/tianyizhuang/anaconda/include/python3.6m -c cpp/mrptmodule.cpp -o build/temp.macosx-10.7-x86_64-3.6/cpp/mrptmodule.o -std=c++11 -O3 -ffast-math -s -fno-rtti -fopenmp -DNDEBUG -march=native
    clang-4.0: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
    In file included from cpp/mrptmodule.cpp:6:
    /Users/tianyizhuang/anaconda/include/python3.6m/Python.h:25:10: fatal error: 'stdio.h' file not found
    #include <stdio.h>
             ^~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/Users/tianyizhuang/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-1ligc2ie-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-z3mysqps-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/66/rk12_30x5dvbpg0pk_glwg2c0000gn/T/pip-1ligc2ie-build/
ejaasaari commented 6 years ago

Do you have Xcode Command Line Tools installed? Try

xcode-select --install

tony-tian commented 6 years ago

ensure the installation..still unable to install...but very thanks for help! still hope for further communication

ejaasaari commented 6 years ago

Can you try what's suggested here, mainly the brew install python part? If that doesn't work, try without using anaconda.

tony-tian commented 6 years ago

hard to work without anaconda...maybe I need to wait for further updates in order to get it working..thanks for the help and reply, and hope for any advice if available.

tony-tian commented 6 years ago

sir...now the question becomes:cpp/Mrpt.h:10:10: fatal error: 'random' file not found.. after google it, I found bit of the question...seemed seldom happened.. do need your help,plz

ejaasaari commented 6 years ago

Your compiler apparently doesn't have C++11 support. What version of clang are you using?

tony-tian commented 6 years ago
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Users/tianyizhuang/anaconda3/bin

I wonder the C++11 support have something wrong because only random package could not be found...

snapstew commented 3 years ago

I saw many similar errors as above, however I was able install successfully on Mac OS Catalina with Anaconda 3.7 using the following commands:

brew update brew install llvm

CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ CPATH=/usr/local/opt/llvm/include/c++/v1 pip install git+https://github.com/teemupitkanen/mrpt/

Thanks for taking the time to open source this great package!