error installing polyglot package in stack heroku-18 and python3.6.12 runtime

149 views Asked by At

I want to deploy a flask server that is capable of upload files and text pre-processing techniques using packages like spacy, polyglot, etc.
while installing the polyglot package in Heroku(i.e. stack Heroku-18) it's always throwing error like below

 ERROR: Command errored out with exit status 1:
            command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u83b_12_/PyICU/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u83b_12_/PyICU/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9jw5frbg/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/PyICU
                cwd: /tmp/pip-install-u83b_12_/PyICU/
           Complete output (95 lines):
           (running 'icu-config --version')
           
           Building PyICU 2.6 for ICU 60.2 (max ICU major version supported: 68)
           
           (running 'icu-config --cxxflags --cppflags')
           Adding CFLAGS="-std=c++11 -I/usr/include" from /tmp/build_83566000/.apt/usr/bin/icu-config
           (running 'icu-config --ldflags')
           Adding LFLAGS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" from /tmp/build_83566000/.apt/usr/bin/icu-config
           running install
           running build
           running build_py
           creating build
           creating build/lib.linux-x86_64-3.6
           copying PyICU.py -> build/lib.linux-x86_64-3.6
           creating build/lib.linux-x86_64-3.6/icu
           copying icu/__init__.py -> build/lib.linux-x86_64-3.6/icu
           running build_ext
           building '_icu' extension
           creating build/temp.linux-x86_64-3.6
           gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/app/.heroku/python/include/python3.6m -c _icu.cpp -o build/temp.linux-x86_64-3.6/_icu.o -std=c++11 -I/usr/include -DPYICU_VER="2.6" -DPYICU_ICU_MAX_VER="68"
           In file included from /usr/include/c++/7/clocale:42:0,
                            from /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:41,
                            from /usr/include/c++/7/bits/localefwd.h:40,
                            from /usr/include/c++/7/string:43,
                            from /tmp/build_83566000/.apt/usr/include/unicode/std_string.h:37,
                            from /tmp/build_83566000/.apt/usr/include/unicode/unistr.h:38,
                            from common.h:106,
                            from _icu.cpp:27:
           ./locale.h:29:23: error: ‘Locale’ was not declared in this scope
            PyObject *wrap_Locale(Locale *locale, int flags);
                                  ^~~~~~
           ./locale.h:29:23: note: suggested alternative: ‘scalb’
            PyObject *wrap_Locale(Locale *locale, int flags);
                                  ^~~~~~
                                  scalb
           ./locale.h:29:31: error: ‘locale’ was not declared in this scope
            PyObject *wrap_Locale(Locale *locale, int flags);
                                          ^~~~~~
           ./locale.h:29:31: note: suggested alternative: ‘locale_t’
            PyObject *wrap_Locale(Locale *locale, int flags);
                                          ^~~~~~
                                          locale_t
           ./locale.h:29:39: error: expected primary-expression before ‘int’
            PyObject *wrap_Locale(Locale *locale, int flags);
                                                  ^~~
           ./locale.h:29:48: error: expression list treated as compound expression in initializer [-fpermissive]
            PyObject *wrap_Locale(Locale *locale, int flags);
                                                           ^
           ./locale.h:30:29: error: ‘Locale’ does not name a type; did you mean ‘scalb’?
            PyObject *wrap_Locale(const Locale &locale);
                                        ^~~~~~
                                        scalb
           ./locale.h:30:43: error: ‘PyObject* wrap_Locale(const int&)’ redeclared as different kind of symbol
            PyObject *wrap_Locale(const Locale &locale);
                                                      ^
           ./locale.h:29:11: note: previous declaration ‘PyObject* wrap_Locale’
            PyObject *wrap_Locale(Locale *locale, int flags);
                      ^~~~~~~~~~~
           In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:41:0,
                            from /usr/include/c++/7/bits/localefwd.h:40,
                            from /usr/include/c++/7/string:43,
                            from /tmp/build_83566000/.apt/usr/include/unicode/std_string.h:37,
                            from /tmp/build_83566000/.apt/usr/include/unicode/unistr.h:38,
                            from common.h:106,
                            from _icu.cpp:27:
           /usr/include/c++/7/clocale:53:11: error: ‘::lconv’ has not been declared
              using ::lconv;
                      ^~~~~
           /usr/include/c++/7/clocale:54:11: error: ‘::setlocale’ has not been declared
              using ::setlocale;
                      ^~~~~~~~~
           /usr/include/c++/7/clocale:55:11: error: ‘::localeconv’ has not been declared
              using ::localeconv;
                      ^~~~~~~~~~
           In file included from /usr/include/c++/7/bits/localefwd.h:40:0,
                            from /usr/include/c++/7/string:43,
                            from /tmp/build_83566000/.apt/usr/include/unicode/std_string.h:37,
                            from /tmp/build_83566000/.apt/usr/include/unicode/unistr.h:38,
                            from common.h:106,
                            from _icu.cpp:27:
           /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:52:23: error: ‘uselocale’ was not declared in this scope
              extern "C" __typeof(uselocale) __uselocale;
                                  ^~~~~~~~~
           /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:52:23: note: suggested alternative: ‘u_fsetlocale’
              extern "C" __typeof(uselocale) __uselocale;
                                  ^~~~~~~~~
                                  u_fsetlocale
           /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
           /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:75:53: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
                __c_locale __old = __gnu_cxx::__uselocale(__cloc);
                                                                ^
           /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:100:33: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
                __gnu_cxx::__uselocale(__old);
                                            ^
           error: command 'gcc' failed with exit status 1
           ----------------------------------------
       ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u83b_12_/PyICU/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u83b_12_/PyICU/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9jw5frbg/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/PyICU Check the logs for full command output.

requirements.txt

spacy==2.2.4
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz
langdetect==1.0.8
googletrans==3.0.0
contractions==0.0.25
inflect==5.0.2
emoji==0.6.0
Flask==1.1.2
nltk==3.5
beautifulsoup4==4.9.3
pandas==1.1.4
python-dotenv==0.15.0
pybind11==2.6.1
fasttext @ git+https://github.com/facebookresearch/fastText.git
gunicorn==20.0.4
polyglot @ git+https://github.com/aboSamoor/polyglot.git@master
sklearn==0.0

Aptfile

# you can list packages
apt-get install --reinstall build-essential libicu-dev g++
# or include links to specific .deb files
#http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb
http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu-dev_67.1-4_amd64.deb
# or add custom apt repos
:repo:deb http://cz.archive.ubuntu.com/ubuntu artful main universe

runtime.txt

python-3.6.12

I referred and tried the below links but no use.
references: https://github.com/aboSamoor/polyglot/issues/152

0

There are 0 answers