首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Python函数中使用AzureML时“失败异常:AzureML:[Errno 30]只读文件系统”

在Python函数中使用AzureML时“失败异常:AzureML:[Errno 30]只读文件系统”
EN

Stack Overflow用户
提问于 2020-08-13 22:20:36
回答 1查看 1.2K关注 0票数 2

问题

我正在尝试准备并提交一个新的实验,让Azure机器从Python中的Azure函数中学习。因此,我为Azure工作区注册了一个新的数据集,其中包含使用dataset.register(...的ML模型的培训数据。但是,当我尝试用下面的代码创建此数据集时

代码语言:javascript
复制
dataset = Dataset.Tabular.from_delimited_files(path = datastore_paths)

然后我得到一个Failure Exception: OSError: [Errno 30] Read-only file system ...

想法

  1. 我知道,如果可能的话,我不应该从Azure函数中写入文件系统。但实际上我不想给本地文件系统写任何东西。我只想创建dataset作为对datastore_path下blob存储的引用,然后将其注册到工作区。但是from_delimited_files似乎无论如何都在尝试写入文件系统(可能是缓存吗?)。
  2. 我还知道有一个临时文件夹允许写入临时文件。然而,我相信我不能真正控制这个方法在哪里写入数据。我已经尝试过使用os.chdir(tempfile.gettempdir())在函数调用之前将当前的工作目录更改为这个临时文件夹,但这没有帮助。

还有其他想法吗?我不认为我做了什么特别不寻常的事.

详细信息

我使用python3.7和azuremlSDK1.9.0,我可以在本地运行python脚本,不会出现问题。我目前使用Azure函数扩展版本0.23.0 (以及用于CI/CD的Azure DevOps管道)从DevOps部署。

下面是我的完整堆栈跟踪:

代码语言:javascript
复制
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.HttpTrigger_Train
 ---> Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException: Result: Failure
Exception: OSError: [Errno 30] Read-only file system: '/home/site/wwwroot/.python_packages/lib/site-packages/dotnetcore2/bin/deps.lock'
Stack:   File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/dispatcher.py", line 345, in _handle__invocation_request
    self.__run_sync_func, invocation_id, fi.func, args)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/dispatcher.py", line 480, in __run_sync_func
    return func(**params)
  File "/home/site/wwwroot/HttpTrigger_Train/__init__.py", line 11, in main
    train()
  File "/home/site/wwwroot/shared_code/train.py", line 70, in train
    dataset = Dataset.Tabular.from_delimited_files(path = datastore_paths)
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/data/_loggerfactory.py", line 126, in wrapper
    return func(*args, **kwargs)
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/data/dataset_factory.py", line 308, in from_delimited_files
    quoting=support_multi_line)
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/dataprep/api/readers.py", line 100, in read_csv
    df = Dataflow._path_to_get_files_block(path, archive_options)
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/dataprep/api/dataflow.py", line 2387, in _path_to_get_files_block
    return datastore_to_dataflow(path)
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/dataprep/api/_datastore_helper.py", line 41, in datastore_to_dataflow
    datastore, datastore_value = get_datastore_value(source)
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/dataprep/api/_datastore_helper.py", line 83, in get_datastore_value
    _set_auth_type(workspace)
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/dataprep/api/_datastore_helper.py", line 134, in _set_auth_type
    get_engine_api().set_aml_auth(SetAmlAuthMessageArgument(AuthType.SERVICEPRINCIPAL, json.dumps(auth)))
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/dataprep/api/engineapi/api.py", line 18, in get_engine_api
    _engine_api = EngineAPI()
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/dataprep/api/engineapi/api.py", line 55, in __init__
    self._message_channel = launch_engine()
  File "/home/site/wwwroot/.python_packages/lib/site-packages/azureml/dataprep/api/engineapi/engine.py", line 300, in launch_engine
    dependencies_path = runtime.ensure_dependencies()
  File "/home/site/wwwroot/.python_packages/lib/site-packages/dotnetcore2/runtime.py", line 141, in ensure_dependencies
    with _FileLock(deps_lock_path, raise_on_timeout=timeout_exception):
  File "/home/site/wwwroot/.python_packages/lib/site-packages/dotnetcore2/runtime.py", line 113, in __enter__
    self.acquire()
  File "/home/site/wwwroot/.python_packages/lib/site-packages/dotnetcore2/runtime.py", line 72, in acquire
    self.lockfile = os.open(self.lockfile_path, os.O_CREAT | os.O_EXCL | os.O_RDWR)

   at Microsoft.Azure.WebJobs.Script.Description.WorkerFunctionInvoker.InvokeCore(Object[] parameters, FunctionInvocationContext context) in /src/azure-functions-host/src/WebJobs.Script/Description/Workers/WorkerFunctionInvoker.cs:line 85
   at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionInvokerBase.cs:line 85
   at Microsoft.Azure.WebJobs.Script.Description.FunctionGenerator.Coerce[T](Task`1 src) in /src/azure-functions-host/src/WebJobs.Script/Description/FunctionGenerator.cs:line 225
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync(Object instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 52
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 587
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 532
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, IFunctionOutputDefinition outputDefinition, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 470
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 278
   --- End of inner exception stack trace ---
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 325
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsyncCore(IFunctionInstanceEx functionInstance, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 117
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-16 22:27:27

这个问题是我的虚拟环境中的一个不兼容的OS版本。

非常感谢PramodValavala-MSFT为他创建一个码头容器的想法!按照他的建议,我突然收到了dataset = Dataset.Tabular.from_delimited_files(path = datastore_paths)命令的以下错误消息:

例外: NotImplementedError:不支持的Linux发行版debian 10。

这让我想起了蔚蓝机器学习文档中的以下警告:

一些dataset类依赖于,它只与64位Python兼容。对于Linux用户,这些类只支持以下发行版:(7,8)、Ubuntu (14.04、16.04、18.04)、Fedora (27、28)、Debian (8、9)和CentOS (7)。

选择预定义的坞映像2.0-python3.7 (运行Debian 9)而不是3.0-python3.7 (运行Debian 10)解决了这个问题(参见/microsoft-azure-functions python)。

我怀疑我最初使用的默认虚拟环境也运行在不兼容的操作系统上。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63403985

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档