由于requirements.txt中的问题,Heroku中的部署失败

wfveoks0  于 2023-10-19  发布在  其他
关注(0)|答案(3)|浏览(132)

我正在尝试在heroku上部署我的flask应用程序。我使用Conda,并使用命令“pip freeze> requirements.txt”来生成requirements.txt文件。但是当我将代码推送到heroku git时,它一直显示requirements.txt错误。我也注意到我的requirements.txt有点奇怪。请帮助我解决这个问题。
这是我的文档. txt文件:

argon2-cffi @ file:///D:/bld/argon2-cffi_1596630042503/work
attrs==19.3.0
backcall @ file:///home/conda/feedstock_root/build_artifacts/backcall_1592338393461/work
backports.functools-lru-cache==1.6.1
bleach @ file:///home/conda/feedstock_root/build_artifacts/bleach_1588608214987/work
brotlipy==0.7.0
certifi==2020.6.20
cffi @ file:///D:/bld/cffi_1595805794566/work
chardet==3.0.4
chart-studio==1.1.0
click==7.1.2
colorama==0.4.3
colorlover==0.3.0
cryptography @ file:///D:/bld/cryptography_1595349005639/work
cufflinks==0.17.3
dash @ file:///home/conda/feedstock_root/build_artifacts/dash_1596870105808/work
dash-core-components @ file:///home/conda/feedstock_root/build_artifacts/dash-core-components_1596203643601/work
dash-html-components==1.0.3
dash-renderer @ file:///home/conda/feedstock_root/build_artifacts/dash-renderer_1596203647496/work
dash-table @ file:///home/conda/feedstock_root/build_artifacts/dash-table_1596867885662/work
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
Flask==1.1.2
Flask-Compress==1.5.0
future==0.18.2
gunicorn==20.0.4
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1593328102638/work
importlib-metadata @ file:///D:/bld/importlib-metadata_1593211580034/work
ipykernel @ file:///D:/bld/ipykernel_1595447084845/work/dist/ipykernel-5.3.4-py3-none-any.whl
ipython @ file:///D:/bld/ipython_1596256504166/work
ipython-genutils==0.2.0
ipywidgets==7.5.1
itsdangerous==1.1.0
jedi==0.15.2
Jinja2==2.11.2
jsonschema==3.2.0
jupyter-client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1594732094290/work
jupyter-core==4.6.3
MarkupSafe==1.1.1
mistune==0.8.4
nbconvert==5.6.1
nbformat @ file:///home/conda/feedstock_root/build_artifacts/nbformat_1594060262917/work
notebook @ file:///D:/bld/notebook_1596502711596/work
numpy @ file:///D:/bld/numpy_1595523081734/work
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1589925210001/work
pandas @ file:///D:/bld/pandas_1595958702229/work
pandocfilters==1.4.2
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1596584577899/work
pickleshare==0.7.5
plotly==4.9.0
prometheus-client @ file:///home/conda/feedstock_root/build_artifacts/prometheus_client_1590412252446/work
prompt-toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1592500439797/work
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1593275161868/work
Pygments==2.6.1
pyOpenSSL==19.1.0
pyparsing==2.4.7
pyrsistent==0.16.0
PySocks==1.7.1
python-dateutil==2.8.1
pytz==2020.1
pywin32==227
pywinpty==0.5.7
PyYAML==5.3.1
pyzmq==19.0.2
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1592425495151/work
retrying==1.3.3
Send2Trash==1.5.0
six==1.15.0
terminado==0.8.3
testpath==0.4.4
tornado==6.0.4
traitlets==4.3.3
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1595434816409/work
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1595859607677/work
webencodings==0.5.1
Werkzeug==1.0.1
widgetsnbextension @ file:///D:/bld/widgetsnbextension_1594164609360/work
win-inet-pton==1.1.0
wincertstore==0.2
zipp==3.1.0

现在错误显示为:

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/D:/bld/argon2-cffi_1596630042503
4nkexdtk

4nkexdtk1#

我在部署到Heroku时也遇到了同样的问题。试试看:
pip list --format=freeze > requirements.txt
在这里找到了答案:https://github.com/pypa/pip/issues/8174

ugmeyewa

ugmeyewa2#

我不确定,但你可以试试这个:
conda list -e > requirements.txt
这里还有一个conda文档https://docs.conda.io/projects/conda/en/latest/commands/list.html?highlight=export的链接

dsekswqp

dsekswqp3#

我找到的答案是使用以下命令:

pip list --format=freeze

这将以正确的格式打印依赖项。

相关问题