SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Installing R packages in SQL Server R Services


Installing R packages in SQL Server R Services

Author
Message
Tomaz Kastrun
Tomaz Kastrun
SSC Eights!
SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)

Group: General Forum Members
Points: 926 Visits: 757
Comments posted to this topic are about the item Installing R packages in SQL Server R Services

Tomaž Kaštrun | twitter: @tomaz_tsql | blog: https://tomaztsql.wordpress.com/
INCREDIBLEmouse
INCREDIBLEmouse
Old Hand
Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)

Group: General Forum Members
Points: 366 Visits: 245
I'm quite surprised the lack of the ability for the analyst/data scientist to install a package and that it not only be installed locally, but also doubly installed in the server path. This should not require a call to an administrator or IT department. Why is that not built into the new VS R IDE? Blink
Iwas Bornready
Iwas Bornready
SSC-Dedicated
SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)

Group: General Forum Members
Points: 31796 Visits: 885
This is a whole new area for me. Thanks for the lesson.
Tomaz Kastrun
Tomaz Kastrun
SSC Eights!
SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)

Group: General Forum Members
Points: 926 Visits: 757
Hi,

you can install package in RTVS (VS R IDE).

IMHO IDE should be prepared for e.g.: client machine with all packages pre-installed (compatible with version), so data wrangled, data analyst should not worry about this.


Best, Tomaž

Tomaž Kaštrun | twitter: @tomaz_tsql | blog: https://tomaztsql.wordpress.com/
Tomaz Kastrun
Tomaz Kastrun
SSC Eights!
SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)

Group: General Forum Members
Points: 926 Visits: 757
Iwas Bornready (9/29/2016)
This is a whole new area for me. Thanks for the lesson.


Great to hear. Hope you enjoyed it.

Best, Tomaž

Tomaž Kaštrun | twitter: @tomaz_tsql | blog: https://tomaztsql.wordpress.com/
INCREDIBLEmouse
INCREDIBLEmouse
Old Hand
Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)

Group: General Forum Members
Points: 366 Visits: 245
tomaz.kastrun (9/30/2016)
Hi,

you can install package in RTVS (VS R IDE).

IMHO IDE should be prepared for e.g.: client machine with all packages pre-installed (compatible with version), so data wrangled, data analyst should not worry about this.


Best, Tomaž


Agreed. That's not the question at hand, or an issue. Having the packages installed on the server as well as the local machine is the problem.

Thoughts?
Tomaz Kastrun
Tomaz Kastrun
SSC Eights!
SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)

Group: General Forum Members
Points: 926 Visits: 757
INCREDIBLEmouse (9/30/2016)
tomaz.kastrun (9/30/2016)
Hi,

you can install package in RTVS (VS R IDE).

IMHO IDE should be prepared for e.g.: client machine with all packages pre-installed (compatible with version), so data wrangled, data analyst should not worry about this.


Best, Tomaž


Agreed. That's not the question at hand, or an issue. Having the packages installed on the server as well as the local machine is the problem.

Thoughts?


Having all the packages aligned with the server version, as well as the R engine would be the easiest way to handle packages on client/local/server/remote machine. In addition,
function RxComputeContext (https://msdn.microsoft.com/en-us/library/mt732690.aspx) gives you ability to push the computation to server/remote machine for better and faster performance. Given this, also job of code validation would be simplified.

In enterprise environment this task should be performed by a administrator.

Best, Tomaž

Tomaž Kaštrun | twitter: @tomaz_tsql | blog: https://tomaztsql.wordpress.com/
INCREDIBLEmouse
INCREDIBLEmouse
Old Hand
Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)

Group: General Forum Members
Points: 366 Visits: 245
:-D

Philosophically, I disagree and would approach it conversely, but I do now understand what you're saying, and the reasoning behind it. Seems like that method will eventually stifle progress. :-)
Tomaz Kastrun
Tomaz Kastrun
SSC Eights!
SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)SSC Eights! (926 reputation)

Group: General Forum Members
Points: 926 Visits: 757
:-) And what is your point of view on this topic, regardless of different point of views (or not).

best

Tomaž Kaštrun | twitter: @tomaz_tsql | blog: https://tomaztsql.wordpress.com/
jroycma
jroycma
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 52
Hello Tomaz,

I want to thank you for all the wonder posts you write to help us all and particularly myself. I have benefited immensely.

I followed you advice with copying and pasting R packages from my R client to my R Services library as described in your post.
However, after copying the R package folder (e.g. ROCR) from my Rclient into R Services library, I obtain an odd result.

The results are as following:

1) R library shows the folder being populated correctly.

2) To verify the result, I ran a script such as ... (sp_execute_external_script @language = N'R', @script = N'OutputDataSet <- data.frame(installed.packages())') ... and the package shows up in the list of packages in the Results tab.

3) However when I run the following .....
execute sp_execute_external_script
@language=N'R',
@script=N'library(ROCR); OutputDataSet<-InputDataSet',
@input_data_1=N'select 1'
WITH RESULT SETS undefined;
GO

I get the following error ......

Msg 39004, Level 16, State 20, Line 8
A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 2, Line 8
An external script error occurred:
Error in library(ROCR) : there is no package called 'ROCR'
Calls: source -> withVisible -> eval -> eval -> library

Error in ScaleR. Check the output for more information.
Error in eval(expr, envir, enclos) :
Error in ScaleR. Check the output for more information.
Calls: source -> withVisible -> eval -> eval -> .Call
Execution halted

OR: (in a second SQL instance)

Msg 39004, Level 16, State 20, Line 1
A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 1, Line 1
An external script error occurred:
Loading required package: gplots
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called 'gtools'
In addition: Warning messages:
1: package 'ROCR' was built under R version 3.4.1
2: package 'gplots' was built under R version 3.3.3
Error: package 'gplots' could not be loaded

Error in ScaleR. Check the output for more information.
Error in eval(expr, envir, enclos) :
Error in ScaleR. Check the output for more information.
Calls: source -> withVisible -> eval -> eval -> .Call
Execution halted

I have tried this on two different SQL instances just to be sure I would get a repeatable issue.

What would cause either of these errors and how can I fix this?

I appreciate the help in advance.

Best wishes,

Jay
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search