I have built an API server with python's Flask package. I'm trying to deploy the server on Heroku using the terminal but doesn't seem to work. I have already tried using the Heroku Build Pack to install packages listed in the Aptfile
with contents:
libicu-dev
pkg-config
python3-icu
python3-setuptools
I also added the and Python Build Pack in the Heroku Web Dashboard. During the installation of Apt Packages
here's the output I get with the Heroku Build Pack
:
Using buildpacks:
remote: 1. https://github.com/heroku/heroku-buildpack-apt.git
remote: 2. heroku/python
remote: -----> Apt app detected
remote: -----> Detected Aptfile or Stack changes, flushing cache
remote: -----> Updating apt caches
remote: Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
remote: Get:2 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
remote: Get:3 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease [86.6 kB]
remote: Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
remote: Get:5 http://apt.postgresql.org/pub/repos/apt focal-pgdg/main amd64 Packages [356 kB]
remote: Get:6 http://archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,232 kB]
remote: Get:7 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [809 kB]
remote: Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,689 kB]
remote: Get:9 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,098 kB]
remote: Fetched 5,499 kB in 1s (4,812 kB/s)
remote: Reading package lists...
remote: -----> Fetching .debs for libicu-dev
remote: Reading package lists...
remote: Building dependency tree...
remote: 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 10 not upgraded.
remote: Need to get 9,450 kB of archives.
remote: After this operation, 0 B of additional disk space will be used.
remote: Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libicu-dev amd64 66.1-2ubuntu2 [9,450 kB]
remote: Fetched 9,450 kB in 1s (10.4 MB/s)
remote: Download complete and in download only mode
remote: -----> Fetching .debs for pkg-config
remote: Reading package lists...
remote: Building dependency tree...
remote: 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 10 not upgraded.
remote: Need to get 45.5 kB of archives.
remote: After this operation, 0 B of additional disk space will be used.
remote: Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 pkg-config amd64 0.29.1-0ubuntu4 [45.5 kB]
remote: Fetched 45.5 kB in 0s (152 kB/s)
remote: Download complete and in download only mode
remote: -----> Fetching .debs for python3-icu
remote: Reading package lists...
remote: Building dependency tree...
remote: The following NEW packages will be installed:
remote: python3-icu
remote: 0 upgraded, 1 newly installed, 0 to remove, and 10 not upgraded.
remote: Need to get 250 kB of archives.
remote: After this operation, 1,192 kB of additional disk space will be used.
remote: Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-icu amd64 2.4.2-0ubuntu3 [250 kB]
remote: Fetched 250 kB in 0s (536 kB/s)
remote: Download complete and in download only mode
remote: -----> Fetching .debs for python3-setuptools
remote: Reading package lists...
remote: Building dependency tree...
remote: The following additional packages will be installed:
remote: python3-pkg-resources
remote: Suggested packages:
remote: python-setuptools-doc
remote: The following NEW packages will be installed:
remote: python3-pkg-resources python3-setuptools
remote: 0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.
remote: Need to get 460 kB of archives.
remote: After this operation, 2,047 kB of additional disk space will be used.
remote: Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-pkg-resources all 45.2.0-1 [130 kB]
remote: Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
remote: Fetched 460 kB in 1s (766 kB/s)
remote: Download complete and in download only mode
remote: -----> Installing libicu-dev_66.1-2ubuntu2_amd64.deb
remote: -----> Installing pkg-config_0.29.1-0ubuntu4_amd64.deb
remote: -----> Installing python3-icu_2.4.2-0ubuntu3_amd64.deb
remote: -----> Installing python3-pkg-resources_45.2.0-1_all.deb
remote: -----> Installing python3-setuptools_45.2.0-1_all.deb
remote: -----> Writing profile script
remote: -----> Rewrite package-config files
remote: -----> Python app detected
Then after the Heroku build pack
is completed, it moves to the Heroku/python
build pack which yields the following error:
remote: Building wheel for bson (setup.py): started
remote: Building wheel for bson (setup.py): finished with status 'done
remote: Created wheel for bson: filename=bson-0.5.10-py3-none-any.whl size=11978 sha256=8054d8bcbad113bbcb2159a90f609f2a909681bcd86728e66024f3db3ef152a1
remote: Stored in directory: /tmp/pip-ephem-wheel-cache-jp_7t95d/wheels/6d/8b/5e/68619cb02962978c6cc8eaf68ca23ef28c69de7e086740702b
remote: Building wheel for polyglot (setup.py): started
remote: Building wheel for polyglot (setup.py): finished with status 'done'
remote: Created wheel for polyglot: filename=polyglot-16.7.4-py2.py3-none-any.whl size=52578 sha256=3982ad5fdef94946e58411dfaf4ace3ffe6c310d06ad4a0f389cdc7e0d9e6171
remote: Stored in directory: /tmp/pip-ephem-wheel-cache-jp_7t95d/wheels/77/4a/9d/5141018da475375d91dc1af07520b1f2b077579f2f55353afb
remote: Building wheel for pycld2 (setup.py): started
remote: Building wheel for pycld2 (setup.py): finished with status 'done'
remote: Created wheel for pycld2: filename=pycld2-0.41-cp39-cp39-linux_x86_64.whl size=9916711 sha256=6f6f7c55d43eabcc9e07778b2279716ba665cef107b4b54f3a40c66a3e72d992
remote: Stored in directory: /tmp/pip-ephem-wheel-cache-jp_7t95d/wheels/ed/98/60/230df7a9368a02bf62e0e2719a31615b2aa82238dea526b637
remote: Building wheel for PyICU (pyproject.toml): started
remote: Building wheel for PyICU (pyproject.toml): finished with status 'error'
remote: ERROR: Command errored out with exit status 1:
remote: command: /app/.heroku/python/bin/python /app/.heroku/python/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpjcmht5hw
remote: cwd: /tmp/pip-install-t0elezrk/pyicu_dd2f596030aa4a418ae49a28c726d303
remote: Complete output (90 lines):
remote: (running 'icu-config --version')
remote: (running 'pkg-config --modversion icu-i18n')
remote:
remote: Building PyICU 2.8 for ICU 66.1 (max ICU major version supported: 70)
remote:
remote: (running 'icu-config --cxxflags --cppflags')
remote: Could not configure CFLAGS with icu-config
remote: (running 'pkg-config --cflags icu-i18n')
remote: (running 'icu-config --ldflags')
remote: Could not configure LFLAGS with icu-config
remote: (running 'pkg-config --libs icu-i18n')
remote: Adding LFLAGS="-licui18n -licuuc -licudata" from /tmp/build_7569cab5/.apt/usr/bin/pkg-config
remote: running bdist_wheel
remote: running build
remote: running build_py
remote: creating build
remote: creating build/lib.linux-x86_64-3.9
remote: copying PyICU.py -> build/lib.linux-x86_64-3.9
remote: creating build/lib.linux-x86_64-3.9/icu
remote: copying icu/__init__.py -> build/lib.linux-x86_64-3.9/icu
remote: running build_ext
remote: building '_icu' extension
remote: creating build/temp.linux-x86_64-3.9
remote: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/app/.heroku/python/include/python3.9 -c _icu.cpp -o build/temp.linux-x86_64-3.9/_icu.o -DPYICU_VER="2.8" -DPYICU_ICU_MAX_VER="70"
remote: In file included from /usr/include/c++/9/clocale:42,
remote: from /usr/include/x86_64-linux-gnu/c++/9/bits/c++locale.h:41,
remote: from /usr/include/c++/9/bits/localefwd.h:40,
remote: from /usr/include/c++/9/string:43,
remote: from /tmp/build_7569cab5/.apt/usr/include/unicode/std_string.h:37,
remote: from /tmp/build_7569cab5/.apt/usr/include/unicode/unistr.h:38,
remote: from common.h:107,
remote: from _icu.cpp:27:
remote: ./locale.h:29:23: error: ‘Locale’ was not declared in this scope; did you mean ‘locale_t’?
remote: 29 | PyObject *wrap_Locale(Locale *locale, int flags);
remote: | ^~~~~~
remote: | locale_t
remote: ./locale.h:29:31: error: ‘locale’ was not declared in this scope; did you mean ‘locale_t’?
remote: 29 | PyObject *wrap_Locale(Locale *locale, int flags);
remote: | ^~~~~~
remote: | locale_t
remote: ./locale.h:29:39: error: expected primary-expression before ‘int’
remote: 29 | PyObject *wrap_Locale(Locale *locale, int flags);
remote: | ^~~
remote: ./locale.h:29:48: error: expression list treated as compound expression in initializer [-fpermissive]
remote: 29 | PyObject *wrap_Locale(Locale *locale, int flags);
remote: | ^
remote: ./locale.h:30:29: error: ‘Locale’ does not name a type; did you mean ‘locale_t’?
remote: 30 | PyObject *wrap_Locale(const Locale &locale);
remote: | ^~~~~~
remote: | locale_t
remote: ./locale.h:30:43: error: ‘PyObject* wrap_Locale(const int&)’ redeclared as different kind of entity
remote: 30 | PyObject *wrap_Locale(const Locale &locale);
remote: | ^
remote: ./locale.h:29:11: note: previous declaration ‘PyObject* wrap_Locale’
remote: 29 | PyObject *wrap_Locale(Locale *locale, int flags);
remote: | ^~~~~~~~~~~
remote: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++locale.h:41,
remote: from /usr/include/c++/9/bits/localefwd.h:40,
remote: from /usr/include/c++/9/string:43,
remote: from /tmp/build_7569cab5/.apt/usr/include/unicode/std_string.h:37,
remote: from /tmp/build_7569cab5/.apt/usr/include/unicode/unistr.h:38,
remote: from common.h:107,
remote: from _icu.cpp:27:
remote: /usr/include/c++/9/clocale:53:11: error: ‘::lconv’ has not been declared
remote: 53 | using ::lconv;
remote: | ^~~~~
remote: /usr/include/c++/9/clocale:54:11: error: ‘::setlocale’ has not been declared
remote: 54 | using ::setlocale;
remote: | ^~~~~~~~~
remote: /usr/include/c++/9/clocale:55:11: error: ‘::localeconv’ has not been declared
remote: 55 | using ::localeconv;
remote: | ^~~~~~~~~~
remote: In file included from /usr/include/c++/9/bits/localefwd.h:40,
remote: from /usr/include/c++/9/string:43,
remote: from /tmp/build_7569cab5/.apt/usr/include/unicode/std_string.h:37,
remote: from /tmp/build_7569cab5/.apt/usr/include/unicode/unistr.h:38,
remote: from common.h:107,
remote: from _icu.cpp:27:
remote: /usr/include/x86_64-linux-gnu/c++/9/bits/c++locale.h:52:23: error: ‘uselocale’ was not declared in this scope; did you mean ‘u_fsetlocale’?
remote: 52 | extern "C" __typeof(uselocale) __uselocale;
remote: | ^~~~~~~~~
remote: | u_fsetlocale
remote: /usr/include/x86_64-linux-gnu/c++/9/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
remote: /usr/include/x86_64-linux-gnu/c++/9/bits/c++locale.h:75:53: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
remote: 75 | __c_locale __old = __gnu_cxx::__uselocale(__cloc);
remote: | ^
remote: /usr/include/x86_64-linux-gnu/c++/9/bits/c++locale.h:100:33: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
remote: 100 | __gnu_cxx::__uselocale(__old);
remote: | ^
remote: error: command '/usr/bin/gcc' failed with exit code 1
remote: ----------------------------------------
remote: ERROR: Failed building wheel for PyICU
remote: Building wheel for readtime (setup.py): started
remote: Building wheel for readtime (setup.py): finished with status 'done'
remote: Created wheel for readtime: filename=readtime-1.1.1-py3-none-any.whl size=7213 sha256=7ca10c74cedd95431d6dea606d72d580e4736608d1dcf844c390015b3db1b221
remote: Stored in directory: /tmp/pip-ephem-wheel-cache-jp_7t95d/wheels/7b/28/2e/aefdfce15ec824db8570b271b2d1069b7f402c054873a74337
remote: Successfully built bson polyglot pycld2 readtime
remote: Failed to build PyICU
remote: ERROR: Could not build wheels for PyICU, which is required to install pyproject.toml-based projects
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to pacific-ridge-08688.
remote:
Perhaps I might be missing one simple thing. I would appreciate any kind assistance.
Thank you.