# Installing RLink on Linux

I'm trying to install RLink here.

Needs["RLink"]
InstallR[]


InstallR::fail: Failed to install R. The following error was
encountered: Unable to load dynamic libraries >>


And then:

RSet["myVar",10]
JLinkJava::argx: Method named rPut defined in class com.wolfram.links.rlink.dataTypes.inTypes.RIntegerVectorInType was called with an incorrect number or type of arguments. The arguments, shown here in a list, were {myVar,$Failed}. >> REvaluate::err: General error in function RLinkPrivatewithRTemporaryVariables >> First::normal: Nonatomic expression expected at position 1 in First[$Failed]. >>
StringReplace::strse: String or list of strings expected at position 1 in StringReplace[StringTrim[First[$Failed]],RLinkFunctionHash12345[[~~DigitCharacter..~~]]:><function>]. >> RSet::puterr: Error putting the expression 10 into a variable myVar in R. The last error message issued by R was StringReplace[StringTrim[First[$Failed]],RLinkFunctionHash12345[[~~DigitCharacter..~~]]:><function>] >>
\$Failed


It isn't java's fault. I've tried pointing JRELocation option of InstallR to different JREs, error stays the same.

I'm on Ubuntu 12.04 64 bit.

-
What platform are you on, precisely (Ubuntu - which version? 64 bit). I will file a bug for this and will deal with this issue as soon as possible. One useful thing you can do to help us is to execute RLinkDevelopergetLog[] right after InstallR[] fails, and send the output to me (leonids@wolfram.com). – Leonid Shifrin Nov 29 '12 at 15:27
@LeonidShifrin Done. – swish Nov 29 '12 at 15:41
In the meantime, consider also installing the external R distribution and then try the "RHomeLocation" option, per @b.gatessucks answer. This may work. If you do try it, please share your results with us. Thanks. – Leonid Shifrin Nov 29 '12 at 16:00

I have R installed separately and can do :

InstallR["RHomeLocation" -> "/usr/lib64/R"]
`

I am able to run the examples provided in the documentation. I use Fedora 17 64 bit.

-
That's good news, man! So, for at least some Linux flavors, RLink does work with an external R distribution. Thanks for sharing this. – Leonid Shifrin Nov 29 '12 at 15:56
@Leonid My pleasure. It would be even better if I knew R. – b.gatessucks Nov 29 '12 at 16:05
Do you need R for anything, at least potentially? – Leonid Shifrin Nov 29 '12 at 16:14
@LeonidShifrin I might have to pick at least one between R and Python soon (for work). – b.gatessucks Nov 29 '12 at 16:15
Actually it works, I'm sure I've tried it before but now it works somehow :). The only difference is that R is inside "/usr/lib/R". Some typo maybe... – swish Nov 29 '12 at 16:56
show 3 more comments

What I suspect is happening is that your flavor of Linux either lacks certain libraries which we considered standard, or has versions of those libraries which are in conflict with some of the ones we ship with the internal R distribution. Unfortunately, it is not easy to diagnose exactly which libraries are problematic, but I will try to follow up on this.

The situation with Linux is currently as follows: we tried our best to test on various Linux distributions, but the way RLink's default R distribution works is such that on some Linux distros there might be library version conflicts, since we had to augment the R distro with additional dependent libraries.

We did test on CentOS 5, and also on Ubuntu. I just re-tested and RLink works for me on Ubuntu 10.04 32 bit running on the virtual box (VMWare). And, it is almost certainly not Java, since RLink uses the JVM that comes with Mathematica. What we will do for Linux is to collect various problems like that, and try to resolve them to the best we can. However, some problems are inherent to Linux having many different flavors with somewhat different core libraries.

-
 @Leonard Shifrin: So it seems you have something to do with implementing RLink. In any case, please be aware that it's unfortunate that for Mac OS X an existing R installation cannot be used at present. In my department, e.g., most office machines provided for faculty are Macs. – murray Dec 6 '12 at 4:20 @murray I am fully aware of that, thanks. There are some technical problems for Macs, hopefully they will be resolved soon, as I already mentioned. – Leonid Shifrin Dec 6 '12 at 10:54