python - 将tensorflow添加到requirements.txt时,Azure Python Function App部署失败

标签 python azure azure-functions

我有一个使用消费计划创建的 Python 函数应用程序。我正在尝试使用 VS Code Function App 扩展来部署一个使用 tensorflow 的应用程序。但是,仅将 tensorflow 添加到requirements.txt 时,部署到 Function App 就失败了。我收到以下错误:

collecting tensorflow
6:04:44 am PostComparisonApp: [00:34:44+0000]   Downloading tensorflow-2.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (578.1 MB)
6:05:10 am PostComparisonApp: Done in 27 sec(s).
6:05:14 am PostComparisonApp: /opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9.7 -p packagedir=.python_packages/lib/site-packages
6:05:14 am PostComparisonApp: Generating summary of Oryx build
6:05:14 am PostComparisonApp: Deployment Log file does not exist in /tmp/oryx-build.log
6:05:14 am PostComparisonApp: The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
6:05:14 am PostComparisonApp: Deployment Failed. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
6:05:26 am PostComparisonApp: Deployment failed.

由于没有对扩展中创建函数时提供的 tempplace 函数进行其他更改,因此出现此错误。 我也尝试运行 func azure functionapppublish 命令,但得到了相同的错误。我已尝试删除该应用程序并创建新的应用程序,但仍然出现同样的错误。

最佳答案

  • 这是我使用 azure 函数部署 tensorflow 的方式。

  • 首先在文件夹中使用命令创建一个虚拟环境

python -m venev test
  • 然后我使用安装了tensorflow
pip isntall tensorflow
  • 现在我在文件夹内创建了该函数,并将 tensorflow 添加到了 requirement.txt。

  • 该函数仅返回 tensorflow 的版本

功能代码:

import  logging
import tensorflow as  tf
import azure.functions as  func

def  main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
name = tf.__version__
return  func.HttpResponse(name)
  • 然后我刚刚将该函数部署到 azure

enter image description here

enter image description here

关于python - 将tensorflow添加到requirements.txt时,Azure Python Function App部署失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74091622/

相关文章:

python - Django:vps 还是共享主机?

azure - 需要有关 Azure 监控的详细信息

windows - 是否可以将 Windows Azure Mobile 服务与需要关系数据库的 Windows 8 应用程序一起使用?

python - 从 VS Code 启动的 Azure Functions 出现 ssl 错误

python - 如何在tensorflow中使用CNN的特征进行物体检测?

python - 如何将列表中的数据插入MySql数据库?

azure - Azure 区域之间的通信缓慢

c# - 用于更新表存储实体的 Azure 函数 - 未找到 CloudTable.Execute

c# - 如何在没有嵌套类的情况下在 Azure Functions 中共享扩展方法?

python - 在 Excel 中使用数据透视表时跨多行进行聚合