无法在Sql Server 2016中运行R代码(致命错误:无法创建'R_TempDir') [英] Can't Run R Code in Sql Server 2016 (Fatal error: cannot create 'R_TempDir')

查看:507
本文介绍了无法在Sql Server 2016中运行R代码(致命错误:无法创建'R_TempDir')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我有一个关于在Sql Server 2016中使用R的问题。我按照以下链接中的说明操作:https://msdn.microsoft.com/en-US/library/mt591996.aspx


我根据上面的链接创建了一个数据表,如下所示:

 CREATE TABLE MyData([Col1] int not null)ON [PRIMARY] 
INSERT INTO MyData VALUES(1);
INSERT INTO MyData Values(10);
INSERT INTO MyData Values(100);
GO

然后根据以上链接尝试在SQL中运行R编码:


执行sp_execute_external_script @language = N'R'
,@ ss = N'OutputDataSet< - InputDataSet;'
,@ input_data_1 = N 'SELECT * FROM MyData;'
WITH RESULT SETS(([NewColName] int NOT NULL));


 

数据表已成功创建,但是当我尝试运行代码"sp_execute_external_script"时发生以下错误:

http: //i.imgur.com/2bUbrDi.png

消息39012,级别16,状态1,行1
无法与'R'的运行时通信'脚本。请检查'R'运行时的要求。
来自外部脚本的STDERR消息:
致命错误:无法创建'R_TempDir'


你们是否有任何关于如何解决这个问题的建议?感谢您提供的任何帮助!


解决方案

您好,


<它对我有用。但是,我花了一些时间来遵循安装说明
https:// msdn。 microsoft.com/library/mt604883(SQL.130).aspx 来信。您是否看到了"安装后服务器配置"?


https://msdn.microsoft.com /en-us/library/mt590536.aspx ?例如


执行sp_configure'外部脚本已启用',1;

重新配置;


很可能需要才能使其正常工作。


根据你的截图,我也注意到MyData位于master数据库中。在我的环境中,我创建了一个专用的测试数据库并将表放在那里。




Hello everyone! I have a question regarding using R in Sql Server 2016. I followed the instructions in the following link: https://msdn.microsoft.com/en-US/library/mt591996.aspx

I created a data table according to the above link as below:

CREATE TABLE MyData ([Col1] int not null) ON [PRIMARY]
 INSERT INTO MyData   VALUES (1);
 INSERT INTO MyData   Values (10);
 INSERT INTO MyData   Values (100) ;
GO

And then tried running the R coding in SQL also according to the above link:

execute sp_execute_external_script  @language = N'R'
, @script = N' OutputDataSet <- InputDataSet;'
, @input_data_1 = N' SELECT *  FROM MyData;'
WITH RESULT SETS (([NewColName] int NOT NULL));

The data table was created successfully, however when I tried running the code "sp_execute_external_script" the following error occurred:

http://i.imgur.com/2bUbrDi.png

Msg 39012, Level 16, State 1, Line 1
Unable to communicate with the runtime for 'R' script. Please check the requirements of 'R' runtime.
STDERR message(s) from external script: 
Fatal error: cannot create 'R_TempDir'


Do any of you have any advice on how to fix this problem? Thank you for any help you can provide!


解决方案

Hello,

It works for me. However, I've taken my time to follow the installation instructions https://msdn.microsoft.com/library/mt604883(SQL.130).aspx to the letter. Did you see the "Post-Installation Server Configuration"

https://msdn.microsoft.com/en-us/library/mt590536.aspx? For example

Exec sp_configure 'external scripts enabled', 1;
reconfigure;

will most likely be required to make it work.

According to your screenshot I also noticed MyData is located in the master database. In my environment I created a dedicated test database and put the table there.


这篇关于无法在Sql Server 2016中运行R代码(致命错误:无法创建'R_TempDir')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆