gpt4 book ai didi

python - Azure DevOps AzureFunctionApp@1 未安装 python 依赖项

转载 作者:行者123 更新时间:2023-12-03 03:40:11 25 4
gpt4 key购买 nike

在当前设置下使用 Azure Devops 任务:

 task: AzureFunctionApp@1
displayName: Deploy Lab
inputs:
azureSubscription: 'serviceConnection'
appType: 'functionAppLinux'
appName: 'myAwesomeApp'
package: '.'
runtimeStack: 'PYTHON|3.8'

此外,在根目录(即 ado 任务中的 .)中,我有一个包含 numpy

的requirements.txt 文件

部署成功运行,但当我测试应用程序时,出现以下错误:

Failure Exception: ModuleNotFoundError: No module named 'numpy'

这只是意味着不考虑requirements.txt文件或者pip install -rrequirements.txt没有在远程计算中成功运行,我做错了什么?

编辑:添加了一个在本地安装软件包的步骤确实有效,但由于 numpy 是一个 C 构建的库,它依赖于主机,并且在远程功能应用程序中不起作用:lol:

我添加的步骤是:

- bash: pip install -r requirements.txt --target="./.python_packages/lib/site-packages"
displayName: 'Install dependencies'

错误:

Result: Failure Exception: ImportError: IMPORTANT: PLEASE READ THISFOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpyC-extensions failed. This error can happen for many reasons, often dueto issues with your setup or how NumPy was installed. We have compiledsome common reasons and troubleshooting tips at:https://numpy.org/devdocs/user/troubleshooting-importerror.html Pleasenote and check the following: * The Python version is: Python3.9 from"/usr/local/bin/python" * The NumPy version is: "1.22.3" and make surethat they are the versions you expect. Please carefully study thedocumentation linked above for further help. Original error was: Nomodule named 'numpy.core._multiarray_umath' . Troubleshooting Guide:https://aka.ms/functions-modulenotfound Stack: File"/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py",line 305, in _handle__function_load_request func =loader.load_function( File"/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/utils/wrappers.py",line 42, in call raise extend_exception_message(e, message) File"/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/utils/wrappers.py",line 40, in call return func(*args, **kwargs) File"/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/loader.py",line 85, in load_function mod = importlib.import_module(fullmodname)File "/usr/local/lib/python3.9/importlib/init.py", line 127, inimport_module return _bootstrap._gcd_import(name[level:], package,level) File "", line 1030, in _gcd_importFile "", line 1007, in _find_and_loadFile "", line 986, in_find_and_load_unlocked File "", line 680, in _load_unlocked File "",line 850, in exec_module File "", line228, in _call_with_frames_removed File"/home/site/wwwroot/bilans/main.py", line 24, in from .import bilan File "/home/site/wwwroot/bilans/bilan.py", line 16, in import numpy as np File"/home/site/wwwroot/.python_packages/lib/site-packages/numpy/init.py",line 144, in from . import core File"/home/site/wwwroot/.python_packages/lib/site-packages/numpy/core/init.py",line 49, in raise ImportError(msg)

最佳答案

也许您必须使用 python 3.9 和管道中最新的 ubuntu 代理

https://github.com/Azure/azure-functions-python-worker/issues/904

关于python - Azure DevOps AzureFunctionApp@1 未安装 python 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71559703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com