bluesheeptoken / CPT

Compact Prediction Tree: A Lossless Model for Accurate Sequence Prediction (cython implementation)
https://cpt.readthedocs.io/en/latest/
MIT License
41 stars 7 forks source link

Cannot Install CPT on macOS Catalina with either pip or setup.py #68

Closed navanchauhan closed 4 years ago

navanchauhan commented 4 years ago

Clang failing with error code 1

Compiling cpt/alphabet.pyx because it changed.
Compiling cpt/cpt.pyx because it changed.
[1/2] Cythonizing cpt/alphabet.pyx
[2/2] Cythonizing cpt/cpt.pyx
running install
running bdist_egg
running egg_info
creating cpt.egg-info
writing cpt.egg-info/PKG-INFO
writing dependency_links to cpt.egg-info/dependency_links.txt
writing top-level names to cpt.egg-info/top_level.txt
writing manifest file 'cpt.egg-info/SOURCES.txt'
reading manifest file 'cpt.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'cpt.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.14-x86_64/egg
running install_lib
running build_ext
building 'cpt.alphabet' extension
creating build
creating build/temp.macosx-10.14-x86_64-3.7
creating build/temp.macosx-10.14-x86_64-3.7/cpt
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c cpt/alphabet.c -o build/temp.macosx-10.14-x86_64-3.7/cpt/alphabet.o -fopenmp -std=c++11
clang: error: unsupported option '-fopenmp'
error: command 'clang' failed with exit status 1
bluesheeptoken commented 4 years ago

Thanks for reporting the issue. Unfortunately, I know there is no wheel on pip for mac users, I need to do it.

However, I added some guidelines to install the project on Mac as a workaround :

brew install llvm # Depending on your OS, you might need the --without-multilib
brew install libomp
'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
CC=/usr/local/opt/llvm/bin/clang++ python setup.py install

Can you tell me if this is solving your issue ?

If you have still the same error, make sure to double check that libompis install and correctly linked by using ll /usr/local/opt/libomp

bluesheeptoken commented 4 years ago

Has it solved your issue ?

navanchauhan commented 4 years ago

I am unable to install llvm right now, as soon as I fix that I will revert back

bluesheeptoken commented 4 years ago

@navanchauhan, Installing brew install libomp is enough to solve your issue.

bluesheeptoken commented 4 years ago

@navanchauhan As a side note, I have published the wheels for macOs users. pip install cpt should be enough now. Could you confirm that ?

navanchauhan commented 4 years ago

Works like a charm!

bluesheeptoken commented 4 years ago

Glad to hear ! :)