pyfasttext
pyfasttext copied to clipboard
Failed to install pyfasttext on MacOS 10.14.6 (Mojave) via pip
I want to install pyfasttext into my project virtual environment on MacOS 10.14.6 (Mojave) via pip.
Some dependencies have been installed (like cython and cysignals), but I still got the error as below.
Tried re-install XCode command line tools, but did not work.
gcc -DNDEBUG -g -fwrapv -O3 -Wall -iquote . -include src/custom_exit.h -Isrc -I/Users/duan/IDMED/zeta_search/venv/lib/python3.6/site-packages/cysignals -I. -Isrc/variant/include -I/Users/duan/IDMED/zeta_search/venv/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/Users/duan/IDMED/zeta_search/venv/lib/python3.6/site-packages/numpy/core/include -c src/fasttext_access.cpp -o build/temp.macosx-10.9-x86_64-3.6/src/fasttext_access.o -Wno-sign-compare -std=c++0x src/fasttext_access.cpp:43:1: error: non-type template argument is not a pointer to member constant ALLOW_METHOD_ACCESS(FastText, bool, checkModel, std::istream&); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:55:38: note: expanded from macro 'ALLOW_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__))(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/fasttext_access.cpp:54:1: error: non-type template argument is not a pointer to member constant ALLOW_CONST_METHOD_ACCESS(Dictionary, int32_t, find, const std::string&); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:59:38: note: expanded from macro 'ALLOW_CONST_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__) const)(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/fasttext_access.cpp:55:1: error: non-type template argument is not a pointer to member constant ALLOW_CONST_METHOD_ACCESS(Dictionary, void, pushHash, std::vector<int32_t>&, int32_t); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:59:38: note: expanded from macro 'ALLOW_CONST_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__) const)(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/fasttext_access.cpp:56:1: error: non-type template argument is not a pointer to member constant ALLOW_METHOD_ACCESS(Dictionary, void, initTableDiscard, ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:55:38: note: expanded from macro 'ALLOW_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__))(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/fasttext_access.cpp:57:1: error: non-type template argument is not a pointer to member constant ALLOW_METHOD_ACCESS(Dictionary, void, initNgrams, ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:55:38: note: expanded from macro 'ALLOW_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__))(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 errors generated. error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /Users/duan/IDMED/zeta_search/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ls/1mmwn3p11nd2j32fbw3704ww0000gn/T/pip-install-itzgumsa/pyfasttext/setup.py'"'"'; __file__='"'"'/private/var/folders/ls/1mmwn3p11nd2j32fbw3704ww0000gn/T/pip-install-itzgumsa/pyfasttext/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/ls/1mmwn3p11nd2j32fbw3704ww0000gn/T/pip-record-haa1t52z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/duan/IDMED/zeta_search/venv/include/site/python3.6/pyfasttext Check the logs for full command output.
I also tried to install and compile via source according to README.md, but I got similar errors.
"Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings] #warning "Using deprecated NumPy API, disable it with " \ ^ 1 warning generated. gcc -DNDEBUG -g -fwrapv -O3 -Wall -iquote . -include src/custom_exit.h -Isrc -I/Users/duan/IDMED/zeta_search/venv/lib/python3.6/site-packages/cysignals -I. -Isrc/variant/include -I/Users/duan/IDMED/zeta_search/venv/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/Users/duan/IDMED/zeta_search/venv/lib/python3.6/site-packages/numpy/core/include -c src/fasttext_access.cpp -o build/temp.macosx-10.9-x86_64-3.6/src/fasttext_access.o -Wno-sign-compare -std=c++0x src/fasttext_access.cpp:43:1: error: non-type template argument is not a pointer to member constant ALLOW_METHOD_ACCESS(FastText, bool, checkModel, std::istream&); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:55:38: note: expanded from macro 'ALLOW_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__))(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/fasttext_access.cpp:54:1: error: non-type template argument is not a pointer to member constant ALLOW_CONST_METHOD_ACCESS(Dictionary, int32_t, find, const std::string&); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:59:38: note: expanded from macro 'ALLOW_CONST_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__) const)(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/fasttext_access.cpp:55:1: error: non-type template argument is not a pointer to member constant ALLOW_CONST_METHOD_ACCESS(Dictionary, void, pushHash, std::vector<int32_t>&, int32_t); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:59:38: note: expanded from macro 'ALLOW_CONST_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__) const)(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/fasttext_access.cpp:56:1: error: non-type template argument is not a pointer to member constant ALLOW_METHOD_ACCESS(Dictionary, void, initTableDiscard, ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:55:38: note: expanded from macro 'ALLOW_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__))(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/fasttext_access.cpp:57:1: error: non-type template argument is not a pointer to member constant ALLOW_METHOD_ACCESS(Dictionary, void, initNgrams, ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/private_access.h:55:38: note: expanded from macro 'ALLOW_METHOD_ACCESS' template struct rob<Only_##MEMBER, (RET_TYPE(CLASS::*)(__VA_ARGS__))(&CLASS::MEMBER)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 errors generated. error: command 'gcc' failed with exit status 1
Finally solved this.
It turned out that MacOS uses clang to compile, and gcc or g++ is just a synonym of clang, so the solution should be :
CXX=/usr/bin/clang CC=/usr/bin/clang pip3 install --no-cache pyfasttext
I use @Kungreye 's way and solved in python 3.8.2 in macos15. but failed when I try the same way with python3.7 in the same MacBook
with python3.7,
pip3 install pyfasttext
shows that:
./src/custom_exit.h:24:10: fatal error: 'cstdlib' file not found
#include CXX=/usr/bin/clang CC=/usr/bin/clang pip3 install --no-cache pyfasttext
it shows that :
./src/custom_exit.h:24:10: fatal error: 'cstdlib' file not found
#include