RProvider
RProvider copied to clipboard
R.Net Initialization error on Mac resolved by starting from Xamarin from terminal
This is more of a workaround for those who might have the same issue as me than a serious issue, although if someone can explain to me how to resolve the underlying issue that would be great as well. I followed the steps in the wiki to set up RProvider for Mac, except I use the homebrew provided mono and R which are both 64bit by default.
When launching Xamarin from the Launchpad I get the following error:
The type provider 'RProvider.RProvider' reported an error: The type provider constructor has thrown an exception: Initialization of R.NET failed
But when launching Xamarin from the terminal using:
open -n /Applications/Xamarin\ Studio.app/
Everything works fine.
Have the same problem but with Visual Code. Also homebrew provided R and Mono. But unlikely @rrottier launching from terminal does not help at all. Running fsharpi from terminal helps neither. Without setting .rprovider.conf
IntelliSense shows an error for not specifying mono64.
cc @evelinag who has been using R provider on Mac and might be able to help?
If I remember correctly, if you start Xamarin Studio from Launchpad, by default it doesn't see the content of your environment variables - so it doesn't find your R or mono installations. One solution is to start it from the Terminal. Then the process inherits all the environment variables that are available in the Terminal when it's started.
An alternative solution is to use the .rprovider.conf
file (see Configuring R provider in the documentation), which tells the RProvider explicitly where to find things. Let me know if you have any issues with this.
@evelinag in my case I have .rprovider.conf
configured but still have Initialization of R.NET failed
error.
@pro100filipp can you extract a detailed log using instructions from here: http://bluemountaincapital.github.io/FSharpRProvider/diagnostics.html ?
As I can see from log file the problem is that despite R_HOME being set RDotNet is attempting to create instance from the default R path (/Library/Frameworks/R.framework/Resources
).
Hmm, it seems that R.NET ignores the DLL when setting the environment variables. We can fix that in R provider by calling SetEnvironmentVariables
before creating the engine.
Out of curiosity, can you try if things works when you create the default folder, even if you just leave it empty? (I wonder if the R_HOME
path matters at all when we give it a direct DLL location...)
Creating the directory led to new Unix transport error
. Logfile attached.
Update
As for temporary solution I've created a symlink to R_HOME
in /Library/Frameworks/R.Frameworks/
.