部署时在azure笔记本中出错:ImportError:没有名为azure.storage.blob的模块

时间:2018-03-01 10:44:53

标签: python azure azure-storage

我们使用azure ml stodio工作区,尝试使用ml studio中的azure笔记本部署模型。

使用以下代码导入azure-storage。

!pip install azure-storage==0.36.0

当我在本地运行时工作但是当它部署到ML studio工作区时,它给了我们这个错误:

{u'error':{u'message':u'Module执行遇到错误。','u'code':u'ModuleExecutionError',u'details':[{u'message':u'Error 0085:脚本评估期间发生以下错误,请查看输出日志以获取更多信息:\ r \ n ----------从Python解释器启动错误消息---------- \ r \ n执行函数时出现异常:Traceback(最近一次调用最后一次):\ n文件“\ server \ InvokePy.py”,第120行,执行脚本\ n outframe = mod.azureml_main(* inframes)\ n文件“\ temp \ 1450604638.py“,第1094行,在azureml_main \ n results.append(__ user_function(client_code))\ n文件”“,第17行,在final_model \ n文件”“,第5行,在data_input \ nImportError:没有模块命名为azure.storage.blob \ n \ r \ n \ r \ n ---------- Python解释器的错误消息结束----------',u'code': u'85',u'target':你执行Python脚本RRS'}]}}

用于部署的代码:

from azureml import Workspace
ws = Workspace()
workspace_id = 'xxxxx'
authorization_token = 'yyyyyy'

from azureml import services
@services.publish(workspace_id, authorization_token)
@services.types(client_code = int)
@services.returns(int)

def final_model(client_code):
import pandas as pd
data_input(account_name,key) # this function has code related to importing data from blob
return client_code

service_url = final_model.service.url
api_key = final_model.service.api_key
help_url = final_model.service.help_url
service_id = final_model.service.service_id

ML studio工作区中存在的包名称是什么,用于从blob导入数据,以便在部署时运行它。

1 个答案:

答案 0 :(得分:0)

我建议您阅读在此documentation

中安装依赖项

运行bellow命令可能会解析依赖关系/缺失模块,但是,此软件包与azure-storage不兼容。如果您安装了azure-storage,或者安装了azure 1.x / 2.x且未卸载azure-storage,则必须先卸载azure-storage

pip install azure

可以找到有关上述命令的更多详细信息here

相关问题