実現したいこと
- Flaskで作成したwebアプリをHerokuにデプロイする
前提
PythonのFlaskを用いてwebアプリを作っています。
Herokuにデプロイした際に以下の問題が発生しました。
発生している問題・エラーメッセージ
ビルドログを読む限り、NumPyのインストール時にビルドが失敗していようです。
Herokuのビルドログ
-----> Building on the Heroku-22 stack -----> Using buildpack: heroku/python -----> Python app detected -----> Using Python version specified in runtime.txt ! ! A Python security update is available! Upgrade as soon as possible to: python-3.11.3 ! See: https://devcenter.heroku.com/articles/python-runtimes ! -----> Installing python-3.11.2 -----> Installing pip 23.1.2, setuptools 67.7.2 and wheel 0.40.0 -----> Installing SQLite3 -----> Installing requirements with pip Collecting backports.entry-points-selectable==1.1.0 (from -r requirements.txt (line 1)) Downloading backports.entry_points_selectable-1.1.0-py2.py3-none-any.whl (6.2 kB) Collecting cachetools==4.2.4 (from -r requirements.txt (line 2)) Downloading cachetools-4.2.4-py3-none-any.whl (10 kB) (省略) gcc: numpy/core/src/umath/ufunc_object.c gcc: numpy/core/src/umath/extobj.c gcc: build/src.linux-x86_64-3.11/numpy/core/src/umath/scalarmath.c error: Command "gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Ibuild/src.linux-x86_64-3.11/numpy/core/src/umath -Ibuild/src.linux-x86_64-3.11/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.11/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-x86_64-3.11/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/app/.heroku/python/include/python3.11 -Ibuild/src.linux-x86_64-3.11/numpy/core/src/common -Ibuild/src.linux-x86_64-3.11/numpy/core/src/npymath -c build/src.linux-x86_64-3.11/numpy/core/src/multiarray/scalartypes.c -o build/temp.linux-x86_64-3.11/build/src.linux-x86_64-3.11/numpy/core/src/multiarray/scalartypes.o -MMD -MF build/temp.linux-x86_64-3.11/build/src.linux-x86_64-3.11/numpy/core/src/multiarray/scalartypes.o.d -std=c99" failed with exit status 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for numpy Failed to build numpy ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. ! Push rejected, failed to compile Python app. ! Push failed
該当のソースコード
requirements.txtの内容
requirements.txt
1backports.entry-points-selectable==1.1.0 2cachetools==4.2.4 3certifi==2021.10.8 4charset-normalizer==2.0.6 5click==8.0.1 6distlib==0.3.2 7filelock==3.0.12 8Flask==2.0.2 9Flask-Login==0.5.0 10Flask-SQLAlchemy==2.5.1 11google-auth==2.3.0 12google-auth-oauthlib==0.4.6 13greenlet==1.1.0 14gspread==4.0.1 15gunicorn==20.1.0 16idna==3.2 17itsdangerous==2.0.1 18Jinja2==3.0.1 19MarkupSafe==2.0.1 20numpy==1.19.5 21oauthlib==3.1.1 22pandas==1.3.3 23platformdirs==2.0.2 24psycopg2==2.9.3 25psycopg2-binary==2.9.3 26pyasn1==0.4.8 27pyasn1-modules==0.2.8 28python-dateutil==2.8.2 29pytz==2021.3 30requests==2.26.0 31requests-oauthlib==1.3.0 32rsa==4.7.2 33six==1.16.0 34SQLAlchemy==1.4.21 35urllib3==1.26.7 36virtualenv==20.6.0 37Werkzeug==2.0.1
試したこと
requirements.txtのNumPyの部分を下記の様に何度か変更してみましたが、同様のエラーでした。
numpy==1.19.5
numpy>=1.21.2
補足情報(FW/ツールのバージョンなど)
Pythonのバージョンは3.11.2です。

回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。