Sea*_*ude 5 python azure azure-functions
v3.6.9尝试使用VS Code Azure Functions 扩展部署 python-runtime ( ) Azure 函数。
我很好地创建了该函数,然后......
Upload从扩展中单击Create new function app in Azure (advanced)Python 3.6为运行时Consumption托管计划Skip for now应用洞察...但是该过程出现错误:
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**.
Run Code Online (Sandbox Code Playgroud)
我也尝试过...
Deploy to Azure...同样的结果。
EDIT1:还尝试根据 @hury-shen 的建议从 cli 执行远程构建:
(.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
Run Code Online (Sandbox Code Playgroud)
然后我继续使用更新应用程序az functionapp update -g <RESOURCE_GROUP_NAME> -n <APP_NAME>。相同的结果。
我还添加了此处列出的应用程序设置,以在 Linux 上启用远程构建。相同的结果。
然后我尝试运行func azure functionapp publish <APP_NAME> --build local并收到错误:
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
Run Code Online (Sandbox Code Playgroud)
然而 pip 显示了pkg-resources满足的依赖性!
(.venv) user@system:~/Documents/azureBlobToS3$ pip install pkg-resources
Requirement already satisfied: pkg-resources in ./.venv/lib/python3.6/site-packages
Run Code Online (Sandbox Code Playgroud)
pkg-resourcesEDIT2:从requirements.txt测试中删除
我被困在这里了。无法远程构建,无法本地构建。
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
Run Code Online (Sandbox Code Playgroud)
还有其他人看到这个错误吗?我该如何排除故障?
通过扩展部署python函数经常会出现一些问题,所以我建议您使用命令将python函数从本地部署到azure。请参考以下步骤:
1.转到azure门户并创建一个函数app(python)。
2.单击 VS 代码中的“终端”按钮,打开“终端”窗口,然后运行以下命令生成“requirements.txt”,其中包含函数中安装的所有模块。
pip freeze > requirements.txt
Run Code Online (Sandbox Code Playgroud)
3.通过运行以下命令将函数从本地部署到 azure:
func azure functionapp publish <functionAppName> --build remote
Run Code Online (Sandbox Code Playgroud)
这<functionAppName>是您刚刚创建的函数应用程序的名称。运行此命令后,功能代码将从本地部署到azure,azure将根据我们上面生成的“requirements.txt”的内容安装模块。
希望有帮助~
| 归档时间: |
|
| 查看次数: |
13167 次 |
| 最近记录: |