我想部署一个应用程序使用Heroku,但它没有设法构建它。请参阅此消息下面的构建日志。
看来我的问题是它不能加载/安装Ta-Lib (我想使用的包)。
我的git项目有4份文件:
worker: python StrategyMade.py freqtrade
pandas
numpy
matplotlib我在网上读到,我需要为Ta-lib构建包,所以我安装了Heroku CLI,然后转到终端,在我的终端中输入命令:
heroku buildpacks:add --index 1 heroku/python -a "name of my project"
heroku buildpacks:add --index 2 numrut/ta-lib -a "name of my project"并检查是否添加了以下内容:
我运行了这个应用程序,但它给了我一些错误。有人能帮我找出哪里出了问题,我如何解决这个问题吗?谢谢!
这是我的构建日志
Building wheel for blosc (PEP 517): finished with status 'done'
Created wheel for blosc: filename=blosc-1.10.2-cp36-cp36m-linux_x86_64.whl size=2311541 sha256=ceefb8ef23ea2204edd8b3551f2052561c4b9d39d3262c8b0e08b7329f35a7fa
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/25/ac/11/5268f9b74f868f4c55d3fa63e4e350543d93e4bd1035e66bfd
Building wheel for TA-Lib (setup.py): started
Building wheel for TA-Lib (setup.py): finished with status 'error'
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-iwphzu1f/TA-Lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iwphzu1f/TA-Lib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-s_lykcmr
cwd: /tmp/pip-install-iwphzu1f/TA-Lib/
Complete output (27 lines):
/tmp/pip-install-iwphzu1f/TA-Lib/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib
copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/tmp/pip-install-iwphzu1f/TA-Lib/.eggs/numpy-1.19.5-py3.6-linux-x86_64.egg/numpy/core/include -I/app/.heroku/python/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o
talib/_ta_lib.c:611:10: fatal error: ta-lib/ta_defs.h: No such file or directory
611 | #include "ta-lib/ta_defs.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for TA-Lib
Running setup.py clean for TA-Lib
Building wheel for sdnotify (setup.py): started
Building wheel for sdnotify (setup.py): finished with status 'done'
Created wheel for sdnotify: filename=sdnotify-0.3.2-py3-none-any.whl size=3212 sha256=1361286b816e23a732caf82e2b98021e5b86ad57082d47b40339832ce585e4fc
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/ad/c7/fb/b9012fda1d8f9e7749915eab363b35fcd09b3a7f699f2a5ae1
Building wheel for wrapt (setup.py): started
Building wheel for wrapt (setup.py): finished with status 'done'
Created wheel for wrapt: filename=wrapt-1.12.1-cp36-cp36m-linux_x86_64.whl size=75931 sha256=83225a868b63939b67454f0018cf7ba94c4030e0e31ab09b67f5a5b710eec0d4
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/32/42/7f/23cae9ff6ef66798d00dc5d659088e57dbba01566f6c60db63
Building wheel for py-find-1st (PEP 517): started
Building wheel for py-find-1st (PEP 517): finished with status 'done'
Created wheel for py-find-1st: filename=py_find_1st-1.1.5-cp36-cp36m-linux_x86_64.whl size=36443 sha256=6d269bbd6bc8578f2f937a46c41ab25d8e084b63e170fa02bce30689b5c4642a
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/90/8d/80/93609354b7435b7f4c3d53407658592cb07bb53e40d9b6015e
Building wheel for pyrsistent (setup.py): started
Building wheel for pyrsistent (setup.py): finished with status 'done'
Created wheel for pyrsistent: filename=pyrsistent-0.17.3-cp36-cp36m-linux_x86_64.whl size=129178 sha256=185ff665281b7f54f0da6d0bb6534cee10f21ce9481ae72fda966e100d1812c5
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/34/13/19/294da8e11bce7e563afee51251b9fa878185e14f4b5caf00cb
Building wheel for idna-ssl (setup.py): started
Building wheel for idna-ssl (setup.py): finished with status 'done'
Created wheel for idna-ssl: filename=idna_ssl-1.1.0-py3-none-any.whl size=3161 sha256=57671bb402e032f7df82fbd0ed50792447c82e9a5b7a712f6698c63a78833cfa
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/6a/f5/9c/f8331a854f7a8739cf0e74c13854e4dd7b1af11b04fe1dde13
Building wheel for typing (setup.py): started
Building wheel for typing (setup.py): finished with status 'done'
Created wheel for typing: filename=typing-3.7.4.3-py3-none-any.whl size=26308 sha256=05c526d654cdd48ab5d66e1c8192840c3844d5bce1cbc6cc9da625f772987b43
Stored in directory: /tmp/pip-ephem-wheel-cache-kmy3d35j/wheels/5f/63/c2/b85489bbea28cb5d36cfe197244f898428004fa3caa7a23116
Successfully built blosc sdnotify wrapt py-find-1st pyrsistent idna-ssl typing
Failed to build TA-Lib
Installing collected packages: tabulate, chardet, urllib3, idna, certifi, requests, wcwidth, prompt-toolkit, questionary, numpy, six, python-dateutil, pytz, pandas, blosc, multidict, yarl, pycparser, cffi, cryptography, idna-ssl, attrs, async-timeout, typing-extensions, aiohttp, pycares, typing, aiodns, ccxt, numexpr, tables, MarkupSafe, jinja2, zipp, importlib-metadata, pyrsistent, jsonschema, cachetools, pycoingecko, TA-Lib, sdnotify, greenlet, SQLAlchemy, python-rapidjson, arrow, wrapt, colorama, py-find-1st, tzlocal, APScheduler, tornado, python-telegram-bot, freqtrade, pillow, kiwisolver, pyparsing, cycler, matplotlib
Running setup.py install for TA-Lib: started
Running setup.py install for TA-Lib: finished with status 'error'
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-iwphzu1f/TA-Lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iwphzu1f/TA-Lib/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-kyza1uz5/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/TA-Lib
cwd: /tmp/pip-install-iwphzu1f/TA-Lib/
Complete output (27 lines):
/tmp/pip-install-iwphzu1f/TA-Lib/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib
copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib
copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/app/.heroku/python/lib/python3.6/site-packages/numpy/core/include -I/app/.heroku/python/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o
talib/_ta_lib.c:611:10: fatal error: ta-lib/ta_defs.h: No such file or directory
611 | #include "ta-lib/ta_defs.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
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-iwphzu1f/TA-Lib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iwphzu1f/TA-Lib/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-kyza1uz5/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/TA-Lib Check the logs for full command output.
! Push rejected, failed to compile Python app.
! Push failed发布于 2021-03-17 08:43:49
TA-Lib是一个C库。它有一个同名为TA-Lib的python包装器。在安装python包装器之前,必须下载C代码并编译。根据您的日志,有些东西尝试安装包装器,而C库没有安装到系统中。但似乎numrut/ta-lib buildpack就是这方面的觉知。
问题似乎在于,freqtrade在您的requirements.txt依赖于TA包装器。numrut/ta-lib正在尝试用pip 从requirements.txt开始编译C源代码并安装TA-Lib包装器(再次使用pip )。所以ta-lib包装器试图安装两次。第一次尝试是在编译C源代码之前进行的,这是一个错误。
可能的解决方案是从freqtrade中删除requirements.txt,并在执行 buildpack numrut/ta-lib之后以某种方式执行。但我不知道Heroku,也不知道如何做到这一点,如果这是可能的。另一个选项是:对numrut/ta-lib构建包进行分叉,并将其更改为脚本,然后使用自己的叉子代替它。或者向numrut/ta-lib 作者解决这个问题--也许他在脚本中绕过了这个问题。或者向自由贸易作家解决这个问题,并要求他们为Heroku制作自己的buildpack。
发布于 2021-10-08 14:20:16
如果您正在运行Ubuntu,您可以运行
sudo apt-get update
sudo apt-get install gcc python3.9你可能甚至不需要python3.9,只有gcc才能做到这一点
如果不是ubuntu,请使用yum或操作系统使用的任何东西。
https://stackoverflow.com/questions/66651988
复制相似问题