Python Azure函数部署失败:`上载生成内容时,从\u包中运行\u的SCM\u格式不正确`
正在尝试使用部署python运行时(Python Azure函数部署失败:`上载生成内容时,从\u包中运行\u的SCM\u格式不正确`,python,azure,azure-functions,Python,Azure,Azure Functions,正在尝试使用部署python运行时(v3.6.9)Azure函数 我创建的函数很好,然后 从分机中单击了上载 在Azure中创建新功能应用程序(高级) 输入全局唯一的函数名 选择Python 3.6作为运行时 选定的消费托管计划 已选择现有资源组(仅为此项目创建) 已选择现有存储帐户(仅为此项目创建) 已选择立即跳过查看应用程序 输出窗口显示“创建新功能应用程序” …但过程中出现以下错误: 11:36:47 PM azblobtoawss3: Creating zip package... 11
v3.6.9
)Azure函数
我创建的函数很好,然后
在Azure中创建新功能应用程序(高级)
消费
托管计划立即跳过查看应用程序
11:36:47 PM azblobtoawss3: Creating zip package...
11:36:47 PM azblobtoawss3: Starting deployment...
11:36:49 PM azblobtoawss3: Updating submodules.
11:36:49 PM azblobtoawss3: Preparing deployment for commit id '3a4998bc20'.
11:36:49 PM azblobtoawss3: Repository path is /tmp/zipdeploy/extracted
11:36:49 PM azblobtoawss3: Running oryx build...
11:36:49 PM azblobtoawss3: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.6 -p packagedir=.python_packages/lib/python3.6/site-packages
11:36:50 PM azblobtoawss3: Build orchestrated by Microsoft Oryx, https://github.com/Microsoft/Oryx
11:36:51 PM azblobtoawss3: You can report issues at https://github.com/Microsoft/Oryx/issues
11:36:51 PM azblobtoawss3: Oryx Version : 0.2.20200114.13, Commit: 204922f30f8e8d41f5241b8c218425ef89106d1d, ReleaseTagName: 20200114.13
11:36:51 PM azblobtoawss3: Build Operation ID: |MIqvQZRaiqA=.6dffab29_
11:36:51 PM azblobtoawss3: Repository Commit : 3a4998bc205144f9998de05338412208
11:36:51 PM azblobtoawss3: Warning: An outdated version of python was detected (3.6.9). Consider updating.\nVersions supported by Oryx: https://github.com/microsoft/Oryx
11:36:51 PM azblobtoawss3: Source directory : /tmp/zipdeploy/extracted
11:36:51 PM azblobtoawss3: Destination directory: /home/site/wwwroot
11:36:51 PM azblobtoawss3: Python Version: /opt/python/3.6.9/bin/python3
11:36:51 PM azblobtoawss3: Running pip install...
11:36:51 PM azblobtoawss3: [06:36:51+0000] Collecting azure-functions
11:36:51 PM azblobtoawss3: [06:36:51+0000] Using cached https://files.pythonhosted.org/packages/5b/6d/67a219c38be7e4eae7c001a9bf83ab059dcf497644ccc6c5f696ea4155fa/azure_functions-1.2.1-py3-none-any.whl
11:36:51 PM azblobtoawss3: [06:36:51+0000] Installing collected packages: azure-functions
11:36:51 PM azblobtoawss3: [06:36:51+0000] Successfully installed azure-functions-1.2.1
11:36:51 PM azblobtoawss3: WARNING: You are using pip version 19.3.1; however, version 20.1.1 is available.
11:36:51 PM azblobtoawss3: You should consider upgrading via the 'pip install --upgrade pip' command.
11:36:51 PM azblobtoawss3: [06:36:51+0000] Cleaning up...
11:36:51 PM azblobtoawss3: Done in 1 sec(s).
11:36:51 PM azblobtoawss3: Done running pip install.
11:36:51 PM azblobtoawss3: Copying files to destination directory '/home/site/wwwroot'...
11:36:51 PM azblobtoawss3: Done in 0 sec(s).
11:36:51 PM azblobtoawss3: Removing existing manifest file
11:36:51 PM azblobtoawss3: Creating a manifest file...
11:36:51 PM azblobtoawss3: Manifest file created.
11:36:51 PM azblobtoawss3: Done in 1 sec(s).
11:36:53 PM azblobtoawss3: Running post deployment command(s)...
11:36:53 PM azblobtoawss3: Triggering recycle (preview mode disabled).
11:36:53 PM azblobtoawss3: Creating placeholder blob for linux consumption function app...
11:36:53 PM azblobtoawss3: **Malformed SCM_RUN_FROM_PACKAGE when uploading built content**.
11:37:04 PM azblobtoawss3: **Deployment failed**.
我也试过
- 右键单击功能项目
部署到Azure
(.venv) user@system:~/Documents/azureBlobToS3$ func azure functionapp publish azureblobtoawss3 --build remote
Getting site publishing info...
Remote build is a new feature added to function apps.
Your function app azureblobtoawss3 does not support remote build as it was created before August 1st, 2019.
Please use '--build local' or '--build-native-deps'.
For more information, please visit https://aka.ms/remotebuild
然后,我继续使用az functionapp update-g-n更新应用程序,以启用Linux上的远程构建。同样的结果
然后,我尝试运行func azure functionapp publish--改为生成本地,并得到错误:
There was an error restoring dependencies. Could not find a version that satisfies the requirement pkg-resources (from -r /home/user/Documents/azureBlobToS3/requirements.txt (line 19)) (from versions: )
No matching distribution found for pkg-resources (from -r /home/user/Documents/azureBlobToS3/requirements.txt (line 19))
ERROR: ['/home/user/Documents/azureBlobToS3/.venv/bin/python3', '-m', 'pip', 'download', '-r', '/home/user/Documents/azureBlobToS3/requirements.txt', '--dest', '/tmp/azureworkerjv2xkb_k'] failed with exit code 1
然而,pip显示满足了pkg资源依赖关系
(.venv) user@system:~/Documents/azureBlobToS3$ pip install pkg-resources
Requirement already satisfied: pkg-resources in ./.venv/lib/python3.6/site-packages
EDIT2:从requirements.txt
中删除pkg资源
,仅用于测试
我在这里陷入了困境。无法在远程生成,无法在本地生成
There was an error restoring dependencies. ERROR: cannot install cryptography-2.9.2 dependency: binary dependencies without wheels are not supported when building locally. Use the "--build remote" option to build dependencies on the Azure Functions build server, or "--build-native-deps" option to automatically build and configure the dependencies using a Docker container. More information at https://aka.ms/func-python-publish
还有其他人看到这个错误吗?如何排除故障?通过扩展部署python函数经常出现一些问题,因此我建议您使用命令将python函数从本地部署到azure。请参考以下步骤:
1。转到azure门户并创建函数应用程序(python)
2.单击VS代码中的“终端”按钮,打开“终端”窗口,运行下面的命令生成“requirements.txt”,其中包括安装在您的函数中的所有模块
pip freeze > requirements.txt
3.通过运行以下命令将函数从本地部署到azure:
func azure functionapp publish <functionAppName> --build remote
func azure functionapp发布--构建远程
是您刚才创建的功能应用程序的名称。运行此命令后,功能代码将从本地部署到azure,azure将通过上面生成的“requirements.txt”的内容安装模块
希望能有所帮助~我遇到了这些完全相同的错误,包括编辑错误,并按照所有建议的步骤解决。我的问题是VSCode,尽管安装了3.6,但我还是使用Python 3.7进行构建。卸载Python 3.7并强制执行3.6构建解决了我的问题。请参阅OP中的“Edit1”。感谢您Hi@SeaDude,因为错误消息提到您的函数应用程序是在2019年8月1日之前创建的,所以您能否尝试在门户上创建另一个函数应用程序并将函数代码从本地部署到它?我昨天刚刚创建了它~!将尝试从门户而不是VS代码扩展创建。Hi@huryshen。在Azure Portal中构建函数应用程序(容器),然后运行func Azure functionapp publish appName--build remote
,我得到了相同的结果。错误:远程生成是功能应用程序中添加的新功能。您的函数应用程序appName不支持远程生成,因为它是在2019年8月1日之前创建的。请使用'--build local'或'--build native deps'。欲了解更多信息,请访问https://aka.ms/remotebuild
@SeaDude很奇怪,我很抱歉不能为您提供更多帮助。但我认为,您可以通过以下步骤在azure portal上获得支持票证。azure支持团队将在这方面帮助您。