question

HarryCoenen-9384 avatar image
0 Votes"
HarryCoenen-9384 asked EchoLiu-msft commented

installinglanguage extensions in SQL 2019

Hello,

got language extensions from github:
https://github.com/microsoft/sql-server-language-extensions

And tried several variations of the following:

CREATE EXTERNAL LANGUAGE [HR]
FROM (CONTENT = N'C:\temp\110R-lang-extension-windows-release.zip',
FILE_NAME = 'libRExtension.dll',
ENVIRONMENT_VARIABLES = N'{"R_HOME": "C:\\Program Files\\R\\R-4.1.0","PATH":"C:\\Program Files\\Microsoft SQLServer\\MSSQL15.MSSQLSERVER\\MSSQL\\ExternalLanguages\\1\\65552"}');
GO

followed by the test:

EXEC sp_execute_external_script
@language =N'HR',
@script=N'
print(R.home());
print(file.path(R.home("bin"), "R"));
print(R.version);
print("Hello RExtension!");'
;

With error message:
Msg 39004, Level 16, State 20, Line 94
A 'HR' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.


So ran out of ideas on this one.

Any ideas here?

Greetings
Harry

sql-server-transact-sql
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you please validate all the answers so far and provide any update?
If all of them are not working or helpful, please provide more sample data or details about your issue.
Please remember to accept the answers if they helped. Your action would be helpful to other users who encounter the same issue and read this thread.

Thank you for understanding!

0 Votes 0 ·

Hello EchoLiu-msft<

Thought I indicated that the way I solved it myself works (for me).
I'm not the type of person who upvotes his own answers, sorry.

Hope it's useful for others>

And thank you for your replies.

Greetings
Harry

0 Votes 0 ·

ok thanks for your update!

0 Votes 0 ·
HarryCoenen-9384 avatar image
0 Votes"
HarryCoenen-9384 answered

Hello,

Got it working with R4.0.3 and R.4.1.1.

Install R with admin rights
Start C:\Program Files\R\R-4.1.1\bin\x64\R.exe with admin rights
install.packages("Rcpp", dependencies = TRUE, lib="C:\\Program Files\\R\\R-4.1.1\\library");
pick a repo and install

Add 'C:\Program Files\R\R-4.1.1\bin\x64' (wh quotes) to PATH
Create System variable R_HOME 'C:\Program Files\R\R-4.1.1' (wh quotes)

start CMD with admin rights:
icacls "C:\Program Files\R\R-4.1.1" /grant "NT Service\MSSQLLAUNCHPAD":(OI)(CI)RX /T
icacls "C:\Program Files\R\R-4.1.1" /grant *S-1-15-2-1:(OI)(CI)RX /T

Restart Launchpad service

CREATE EXTERNAL LANGUAGE [HR]
FROM (
CONTENT = N'C:\temp\110R-lang-extension-windows-release.zip'
, FILE_NAME = 'libRExtension.dll'
);

test with:
EXEC sp_execute_external_script
@language =N'HR',
@script=N'
print(R.home());
print(file.path(R.home("bin"), "R"));
print(R.version);
print("Hello RExtension!");'
;

That's it.
In short read the docs at:
https://docs.microsoft.com/en-us/sql/machine-learning/install/custom-runtime-r

Greetings
Harry

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EchoLiu-msft avatar image
0 Votes"
EchoLiu-msft answered EchoLiu-msft edited

Hi @HarryCoenen-9384

Welcome to the microsoft tsql Q&A forum!

I have no experience with this type of problem, so I did a simple search, and
I found a similar problem, the method someone provided is as follows:
You will need to install the software package to the SQL Server instance. There are various ways to install unavailable software packages to the SQL Server instance.

You will choose the method suitable for you depending on your setup.

If you are working on a local machine then you would want to download the Windows Binaries (zip file) of the package and install using T-SQL.

For more details, please refer to:

SQL 2016 with R - Error HRESULT 0x80004004


If you have any question, please feel free to let me know.


Regards
Echo


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.