hrbrmstr / RSwitch

🎛 A small menubar app that allows you to switch between R versions quickly (if you have multiple versions of R framework installed).
MIT License
104 stars 6 forks source link

R GUI versioning with older R installs #8

Open ladworkin opened 5 years ago

ladworkin commented 5 years ago

Thank you for making this utility. It's very helpful!

My R GUI version is 1.70 and works fine with R 3.6. My Rstudio version is 1.2.1335 and works fine with R 3.6 and lower (down to at least 3.4)

However, the R GUI breaks when I change the R version to 3.5 or 3.4. But, this problem is rectified when using an R GUI version released around the same time as the older R version.

Is the intended solution to have multiple R GUI versions?

The error message I get when using R version 3.5:

*** caught segfault ***
address 0x2e9e8, cause 'memory not mapped'

Traceback:
 1: initMethodDispatch(where)
 2: fun(libname, pkgname)
 3: doTryCatch(return(expr), name, parentenv, handler)
 4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 5: tryCatchList(expr, classes, parentenv, handlers)
 6: tryCatch(fun(libname, pkgname), error = identity)
 7: runHook(".onLoad", env, package.lib, package)
 8: loadNamespace(package, lib.loc)
 9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:\n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
13: library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,     warn.conflicts = warn.conflicts, quietly = quietly)
14: doTryCatch(return(expr), name, parentenv, handler)
15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
16: tryCatchList(expr, classes, parentenv, handlers)
17: tryCatch(library(package, lib.loc = lib.loc, character.only = TRUE,     logical.return = TRUE, warn.conflicts = warn.conflicts, quietly = quietly),     error = function(e) e)
18: require(pkg, quietly = TRUE, warn.conflicts = FALSE, character.only = TRUE)
19: .OptRequireMethods()

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

The error message I get when using R version 3.4:

Error in !value : invalid argument type

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Error in !value : invalid argument type
[R.app GUI 1.70 (7632) x86_64-apple-darwin15.6.0]

[History restored from /Users/username/.Rapp.history]

Error in UseMethod("conditionCall") : 
  no applicable method for 'conditionCall' applied to an object of class "NULL"
hrbrmstr commented 5 years ago

Aye.

If you go here — http://mac.r-project.org/ — you'll see the GUI is built for each maj.min R version. This is due to how the "R engine" is built.

Head over to /Applications/R.app/Contents/MacOS in Terminal or iTerm and do:

$ otool -L R

You'll see it's built for a particular framework (shld be first item).

When the symlink is moved for "current" the R.app gui app still thinks it's referencing R 3.6 shared library supporting "things" and it's really not, so it cries out in agony and dies.

So you'd need to have separate R.app's installed (renamed to fit each version)

-Bob

On Oct 15, 2019, at 13:39, ladworkin notifications@github.com wrote:

Thank you for making this utility. It's very helpful!

My R GUI version is 1.70 and works fine with R 3.6. My Rstudio version is 1.2.1335 and works fine with R 3.6 and lower (down to at least 3.4)

However, the R GUI breaks when I change the R version to 3.5 or 3.4. But, this problem is rectified when using an R GUI version released around the same time as the older R version.

Is the intended solution to have multiple R GUI versions?

The error message I get when using R version 3.5:

caught segfault address 0x2e9e8, cause 'memory not mapped'

Traceback: 1: initMethodDispatch(where) 2: fun(libname, pkgname) 3: doTryCatch(return(expr), name, parentenv, handler) 4: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 5: tryCatchList(expr, classes, parentenv, handlers) 6: tryCatch(fun(libname, pkgname), error = identity) 7: runHook(".onLoad", env, package.lib, package) 8: loadNamespace(package, lib.loc) 9: doTryCatch(return(expr), name, parentenv, handler) 10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 11: tryCatchList(expr, classes, parentenv, handlers) 12: tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) { P <- if (!is.null(cc <- conditionCall(e))) paste(" in", deparse(cc)[1L]) else "" msg <- gettextf("package or namespace load failed for %s%s:\n %s", sQuote(package), P, conditionMessage(e)) if (logical.return) message(paste("Error:", msg), domain = NA) else stop(msg, call. = FALSE, domain = NA)}) 13: library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, warn.conflicts = warn.conflicts, quietly = quietly) 14: doTryCatch(return(expr), name, parentenv, handler) 15: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16: tryCatchList(expr, classes, parentenv, handlers) 17: tryCatch(library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, warn.conflicts = warn.conflicts, quietly = quietly), error = function(e) e) 18: require(pkg, quietly = TRUE, warn.conflicts = FALSE, character.only = TRUE) 19: .OptRequireMethods()

Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace

The error message I get when using R version 3.4:

Error in !value : invalid argument type

R version 3.6.1 (2019-07-05) -- "Action of the Toes" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

Error in !value : invalid argument type [R.app GUI 1.70 (7632) x86_64-apple-darwin15.6.0]

[History restored from /Users/username/.Rapp.history]

Error in UseMethod("conditionCall") : no applicable method for 'conditionCall' applied to an object of class "NULL"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

bryanhanson commented 5 years ago

Thanks for asking this question, I had wondered as well. I renamed R.app to R361.app (for the version). Then, I installed the devel = 4.0.0 version. The process went fine, no problems, but did not leave me with a fresh R.app, which I was intending to rename to R400.app. The R361.app was not modified.

Any ideas about where the devel R.app went? Maybe it was omitted from the installer? Or did the install process see my R361.app and not do the R.app install?

bryanhanson commented 4 years ago

Looks like no matter what the current R.app is renamed to, the 4.0.0 installer stomps on it. So must be a characteristic of the installer to find the current version by some other more generic means.