Message Boards Message Boards

2
|
8600 Views
|
11 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Why still cannot use own R distribution on Mac?

Mathematica on Windows has for some time allowed using InstallR to install one's own R distribution instead of the curated Wolfram provided version. But not on other platforms, including Mac

Still in Mathematica 12.1, only Windows is supported for such user-provided R distributions.

Why is that facility still not supported on Mac (and other platforms)?

What is the impediment?

POSTED BY: Murray Eisenberg
11 Replies

Can somebody tell me how to install the rJava package?

I tried using the Package Installer of R.app. If I first try to get a package list from CRAN there, I get a " unable to access index for repository" error. And if I simply search for rJava in the Package Installer search field, nothing seems to happen.

Next, I found rJava at CRAN online and downloaded the rJava_0.9-13.tgz, which is supposed to be the latest Mac binary for the package. So in the R.app console I executed command:

install.packages("rJava_0.9-13.tgz",lib="/Users/murray/Downloads",repos=NULL)

But I got error:

tar: Error opening archive: Failed to open 'rJava_0.9-13.tgz'
Error: file ‘rJava_0.9-13.tgz’ is not a macOS binary package

Now what?

POSTED BY: Murray Eisenberg

I was able to install rJava (in /Library/Frameworks/R.framework/Resources/library) by the using RStudio app instead of the R app.

POSTED BY: Murray Eisenberg

Alas, the method described at http://szhorvat.net/pelican/setting-up-rlink-for-mathematica.html#elcap in "Note for R version 3.5 (and possibly later) on macOS" does not work under macOS Catalina 10.15.3. This is with the current R version, which is 3.6, and Mathematica 12.1.

Instead, it generates error:

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

I presume this is caused by the SIP issue (or other stricter security under macOS Catalina).

POSTED BY: Murray Eisenberg

The problem must be specific to Catalina.

I tried it with Mojave (10.14) before posting, and there it works. Indeed it must be a security issue. Unfortunately, I cannot upgrade to Catalina because some of the programs I use are not compatible.

POSTED BY: Szabolcs Horvát

I tried Szabolcs' "Note for R version 3.5 (and possibly later) on macOS" using Mathematica 12.1.1 under macOS Catalina 10.15.6, and it worked for me (R 3.6.1). [I did this without first installing the version of R packaged with RLink, if that makes any difference.]

The only odd side-effect of this that I can detect (perhaps from uninstalling the Java runtime) is that using F1 to bring up context sensitive help on any of the RLink functions (e.g. InstallR, REvaluate, etc) fails to locate the paclet associated with these functions. It is still possible to access the documentation via ??RLink`REvaluate though.

POSTED BY: Mark Dowdeswell

I tried Szabolcs' "Note for R version 3.5 (and possibly later) on macOS" using Mathematica 12.1.1 under macOS Catalina 10.15.6, but with the current R, namely, R 4.0. The commands used were:

Needs["RLink`"]
JLink`UninstallJava[];
InstallR[
 "RVersion" -> 4,
 "RHomeLocation" -> "/Library/Frameworks/R.framework/Resources",
 "NativeLibLocation" -> 
  "/Library/Framewworks/R.framework/Resources/library/rJava/jri"
 ]

The last one failed with error:

InstallR::fail: Failed to install R. The following error was encountered: Unable to load dynamic libraries
POSTED BY: Murray Eisenberg

What exactly is the step JLinkUninstallJava[ ]` of Szabolcs method doing — and why?

POSTED BY: Murray Eisenberg

I installed R 4.0.2 (for the first time), and got the same error that you did. After I ran install.packages("rJava") (in RStudio), everything worked for R4 as it did for me for R3 (as far as I can tell).

Perhaps try re-install the rJava package?

POSTED BY: Mark Dowdeswell

@Murray, you are probably aware of these workarounds (scroll to the bottom): http://szhorvat.net/pelican/setting-up-rlink-for-mathematica.html

POSTED BY: Szabolcs Horvát

My colleague reported this issue to Wolfram support back in February. The Prerelease team said older versions of R were working on their computers. They sent the information over to the developers though. I don't think we've heard back since then. Sorry I don't have anything more useful than that to add.

POSTED BY: Eric Smith

My colleague reported this issue to Wolfram support back in February.

This was actually already reported back in 2012 when RLink came out, and many more times since then. The only conclusion I can draw is that WRI simply has no interest in giving RLink any developer time.

RLink was very promising, but it looked only 90% complete. It could have been an extremely useful tool, if just a few critical missing features had been added ...

POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract