How to install machine learning on SQL Server 2022 named instance?

Christoph Muthmann 181 Reputation points
2023-08-18T12:02:54.3066667+00:00

I've installed SQL Server 2022 (EE RTM and with CU7) and machine learning on a default instance without any problem. Installing it on a named instance runs fine as well. (R 4.2.0 and R 4.2.3)

But when I run my test statement there are warnings on the named instance.

EXEC sp_execute_external_script @language =N'R', @script=N'print("Hello World from R")';

The result is not only the message, but some warnings (BTW very interesting the german word "Warnmeldung" eq. "Warning" on a system I thought to be installed in english)

STDERR message(s) from external script: 
Warnmeldung:
In normalizePath(path.expand(path), winslash, mustWork) :
  path[1]="C:/ProgramData/myinstancename/R/library": Access is denied
Warnmeldung:
package "methods" in options("defaultPackages") was not found 
STDOUT message(s) from external script: 
[1] "Hello World from R"

What is wrong with the installation?

Kind regards
Christoph

SQL Server Other
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-08-18T21:29:54.35+00:00

    Access is denied suggests that there is a permission problem. I would guess that the account NT Service\MSSQLLaunchpad$INSTANCE does have permission on the folder in the error message.

    2 people found this answer helpful.

  2. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-08-24T20:51:24.67+00:00

    I tried to install both Python and R for my SQL 2022 which is a named instance. None of them worked, and for R I got the same error message as you.

    However, I was able to remove the error message for R.

    I first made sure that NT Service\MSSQLLAUNCHPAD$Instance and ALL APPLICATION PACKAGES had permissions to C:\ProgramData\INSTANCE. If memory serves, ALL APPLICATION PACKAGES was there, but not the service account. I also reviewed the permissions on the specific folder, and maybe I added something there as well. Still no cigar. But then I also gave ALL APPLICATION PACKAGES and NT Service\MSSQLLAUNCHPAD$Instance permission on C:\ProgramData. When I did this, I selected "This folder only" to keep things locked down.

    This removed the message about "Access is denied".

    ...However, when I run a simple test script, I get:

    Msg 39012, Level 16, State 14, Line 31 Unable to communicate with the runtime for 'R' script for request id: 6EB1E800-8635-4115-B810-E49C9E799CA3. Please check the requirements of 'R' runtime. STDERR message(s) from external script: Error: Script file C:\ProgramData\TJUTVÅ\Temp-R\Appcontainer1\7BE0FCDC-1A76-48F8-8F07-8296FB657158\7BE0FCDC-1A76-48F8-8F07-8296FB657158.R missing for pooled session Execution halted

    I have not investigated what happens with the purportedly missing file.

    1 person found this answer helpful.

  3. Vahid Ghafarpour 23,385 Reputation points Volunteer Moderator
    2023-08-18T17:42:31.2633333+00:00

  4. RahulRandive 10,486 Reputation points Volunteer Moderator
    2023-08-18T23:44:01.9333333+00:00

  5. ZoeHui-MSFT 41,491 Reputation points
    2023-08-21T06:19:43.4433333+00:00

    Hi @Christoph Muthmann

    Access is denied

    Seems like a permission issue, make sure your account has full permission to access the folders.

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.