问题描述
请注意:这在本地可正常使用,但仅在使用天蓝色在线功能时会出现问题.
Please note: This works fine locally but only makes an issue when working on azure online function.
错误:
Result: Failure
Exception: ModuleNotFoundError: No module named 'pandas'
Stack: File "/azure-functions-host/workers/python/3.6/LINUX/X64/azure_functions_worker/dispatcher.py", line 242, in _handle__function_load_request
func_request.metadata.entry_point)
File "/azure-functions-host/workers/python/3.6/LINUX/X64/azure_functions_worker/loader.py", line 66, in load_function
mod = importlib.import_module(fullmodname)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/site/wwwroot/HttpExample/__init__.py", line 20, in <module>
import pandas as pd
进口:
import importlib
import logging
import azure.functions as func
import urllib.request
from zipfile import ZipFile
import json
import csv
import os
import pathlib
import os.path
from pathlib import Path
import time
import pandas as pd
from datetime import datetime
from dateutil.relativedelta import relativedelta
要求:
adal==1.2.2
antlr4-python3-runtime==4.7.2
applicationinsights==0.11.9
argcomplete==1.10.0
azure-cli-command-modules-nspkg==2.0.3
azure-cli-core==2.0.76
azure-cli-nspkg==3.0.4
azure-cli-profile==2.1.5
azure-cli-telemetry==1.0.4
azure-common==1.1.23
azure-functions==1.0.4
azure-mgmt-resource==4.0.0
azure-nspkg==3.0.2
bcrypt==3.1.7
certifi==2019.9.11
cffi==1.13.2
chardet==3.0.4
colorama==0.4.1
cryptography==2.8
humanfriendly==4.18
idna==2.8
isodate==0.6.0
jmespath==0.9.4
knack==0.6.3
msrest==0.6.10
msrestazure==0.6.2
numpy==1.17.3
oauthlib==3.1.0
pandas==0.25.3
paramiko==2.6.0
portalocker==1.5.1
pycparser==2.19
Pygments==2.4.2
PyJWT==1.7.1
PyNaCl==1.3.0
pyOpenSSL==19.0.0
python-dateutil==2.8.1
pytz==2019.3
PyYAML==5.1.2
requests==2.22.0
requests-oauthlib==1.2.0
six==1.12.0
tabulate==0.8.5
urllib3==1.25.6
我尝试过的操作:az帐户清除&az登录.如果我写: func azure functionapp发布空气温度
What I have tried : az account clear & az login.If i write : func azure functionapp publish air-temperature
这将导致错误:还原依赖项时出错.错误:无法安装cryptography-2.8依赖项:不支持没有轮子的二进制依赖项.使用"--build remote"或"--build-native-deps"选项可使用Docker容器自动构建和配置依赖项.有关更多信息,请访问https://aka.ms/func-python-publish
我没有使用docker集成,所以我无法执行--build-native-deps
I am not using docker integration so i cant do the --build-native-deps
我正在使用azure信息库将其推送到azure仓库中,并且它的构建似乎没有依赖性或任何错误.但是,如果我通过门户网站在线运行它,则会出现此错误,如顶部所述.
I am using azure repositories to push it into the azure repo and it is build seemlessly without errors on dependencies or anything. But if i run it online through portal it give this error as mentioned at the top.
我还尝试在python上使用venv和env并进行pip冻结> requirements.txt.
I have also tried using the venv and env on python and did pip freeze > requirements.txt.
推荐答案
您可以使用 -无捆绑软件
.
这是 解释代码>
.
-无捆绑程序标志绕过该捆绑过程.因此,我们不使用Pyinstaller或任何此类模块进行临时优化.这请注意,您可能会遇到轻微的延迟(冷启动)到达API终点时.
--no-bundler flag bypasses that bundling process. So, we do not use Pyinstaller or any such module to do temporary optimizations. The caveat is that you may experience slight linger delay (cold start) when hitting your API end-point.
这篇关于缺少对Python Azure函数的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!