我在 SQL Server 2019 中运行 R 3.5.2。
使用以下命令加载预训练的 udpipe 模型:
udmodel_english <- udpipe_load_model(file = ''C:/ud/english-ewt-ud-2.5-191206.udpipe'')
这在 Rstudio 和 R 中可以正常工作。但是,当作为 SQL 外部脚本运行时,出现以下错误:
Error in udpipe_load_model(file = "C:/ud/english-ewt-ud-2.5-191206.udpipe") :
File C:/ud/english-ewt-ud-25-191206.udpipe containing the language model does not exist
Calls: source -> withVisible -> eval -> eval -> udpipe_load_model
但是文件在那里,它确实存在,并且通过 Rstudio 加载没有问题。
任何建议都会非常有帮助。
完整代码仅供参考:
Begin
EXEC sp_execute_external_script
@language = N'R',
@script = N'
library(zoo)
library(xts)
library(udpipe)
#model <- udpipe_download_model(language = "english")
udmodel_english <- udpipe_load_model(file = ''C:/ud/english-ewt-ud-2.5-191206.udpipe'')
'
End
仅供参考的完整错误:
Msg 39004, Level 16, State 20, Line 29
A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 2, Line 29
An external script error occurred:
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Error in udpipe_load_model(file = "C:/ud/english-ewt-ud-2.5-191206.udpipe") :
File C:/ud/english-ewt-ud-25-191206.udpipe containing the language model does not exist
Calls: source -> withVisible -> eval -> eval -> udpipe_load_model
In addition: Warning messages:
1: package 'zoo' was built under R version 3.5.3
2: package 'xts' was built under R version 3.5.3
3: package 'udpipe' was built under R version 3.5.3
Error in execution. Check the output for more information.
Error in eval(ei, envir) :
Error in execution. Check the output for more information.
Calls: runScriptFile -> source -> withVisible -> eval -> eval -> .Call
Execution halted
谢谢