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

如何解决在Python Azure函数中使用AzureML时出现“失败异常:OSError:[Errno 30]只读文件系统”

问题

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

dataset = Dataset.Tabular.from_delimited_files(path = datastore_paths)

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

想法

  1. 我知道,如果可能的话,我不应该从Azure函数中写入文件系统。但是我实际上不想将任何内容写入本地文件系统。我只想创建数据集作为对datastore_path下我的Blob存储的引用,然后将其注册到我的Azure Machine Learning工作区。但是看来方法from_delimited_files无论如何都试图写入文件系统(也许有一些缓存?)。
  2. 我还知道有一个临时文件夹,允许在其中写入临时文件。但是,我相信我无法真正控制此方法在何处写入数据。我已经尝试在使用os.chdir(tempfile.gettempdir())进行函数调用之前将当前工作目录更改为此临时文件夹,但这没有帮助。

还有其他想法吗?我认为我没有做特别特别的事情...

详细信息

我正在使用python 3.7和azureml-sdk 1.9.0,可以在本地运行python脚本而不会出现问题。我目前使用VSCode使用Azure Functions扩展版本0.23.0(以及用于CI / CD的Azure DevOps管道)进行部署。

这是我的完整堆栈跟踪记录:

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,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,IFunctionOutputDefinition outputDefinition,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,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,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

解决方法

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

PramodValavala-MSFT非常感谢他提出创建docker容器的想法!遵循他的建议,我突然收到dataset = Dataset.Tabular.from_delimited_files(path = datastore_paths)命令的以下错误消息:

异常:NotImplementedError:不支持的Linux发行版debian 10。

这使我想起了天蓝色机器学习文档中的以下警告:

某些数据集类对Azureml-dataprep有依赖性 软件包,仅与64位Python兼容。对于Linux用户, 这些类仅在以下发行版中受支持:红色 Hat Enterprise Linux(7、8),Ubuntu(14.04、16.04、18.04),Fedora(27, 28),Debian(8、9)和CentOS(7)。

选择预定义的Docker映像2.0-python3.7(运行Debian 9)而不是3.0-python3.7(运行Debian 10)解决了该问题(请参阅https://hub.docker.com/_/microsoft-azure-functions-python)。

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-