【问题标题】:Getting error in azure notebooks while deploying : ImportError: No module named azure.storage.blob部署时在 azure 笔记本中出错:ImportError: No module named azure.storage.blob
【发布时间】:2018-08-09 10:01:11
【问题描述】:

我们正在使用 azure ml stodio 工作区,并尝试使用 ml studio 中的 azure notebook 部署模型。

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

!pip install azure-storage==0.36.0

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

{u'error': {u'message': u'模块执行遇到错误。', u'code': u'ModuleExecutionError', u'details': [{u'message': u'Error 0085: 脚本评估期间发生以下错误,请查看输出日志以获取更多信息:\r\n---------- Python 解释器错误消息开始 ---------- \r\n执行函数时捕获异常:Traceback(最近一次调用最后一次):\n 文件“\server\InvokePy.py”,第 120 行,在 executeScript\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: No module命名为 azure.storage.blob\n\r\n\r\n---------- 来自 Python 解释器的错误消息结束 ----------', u'code': u'85', u'target': u'执行 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 导入数据以便在部署时运行的包名称是什么。

【问题讨论】:

    标签: python azure azure-storage


    【解决方案1】:

    我建议阅读 documentation 中的安装依赖项

    运行以下命令可能会解决依赖项/缺少的模块,但是,此包与 azure-storage 不兼容。如果您安装了 azure-storage,或者您安装了 azure 1.x/2.x 并且没有卸载 azure-storage,则必须先卸载 azure-storage

    pip install azure
    

    关于上述命令的更多细节可以找到here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-26
      • 1970-01-01
      • 2016-11-27
      • 2017-03-16
      • 1970-01-01
      • 2015-11-24
      • 2021-12-05
      • 1970-01-01
      相关资源
      最近更新 更多