When setup R or Python on SQL Server 2022, especially for named instance, some special notes required, apart from the offical documentation.
You need to make sure when doing install, both Database Engine Services and Maching Learning Services and Language are installed.
Unlike with earlier version of SQL, R and Python libraries are not installed/configured automatically in SQL 2022.
You need to download and install latest R4.2. Then need to install some standard R dependencies. Then need to run RegisterRext.exe and pass in instance name as MSSQLSERVER (for default instance) or the named instance name (just the name without machineName part).
Even if you finished above steps, things might not work straight after. You may wait a bit or try a few attempts and it will eventurly work. Just someone’s experience and no explaination why it’s like that.
For more details, refers to blog post from Greg Low below.
Resource:
Fix: Getting R and Python to actually work on SQL Server 2022