Sage-Bionetworks / synapser

An R package providing programmatic access to Synapse
Apache License 2.0
32 stars 21 forks source link

synapser 0.8.71 fails on load #292

Closed GabrielHoffman closed 3 years ago

GabrielHoffman commented 3 years ago

I just computed R 4.0.3 from source on my Mac. When I install synapser with

install.packages("synapser", repos=c("http://ran.synapse.org", "http://cran.fhcrc.org"), type="mac.binary")

and then load the package in an empty R session I get:

library(synapser)

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

Traceback:
 1: pyIsConnected()
 2: pyConnect()
 3: fun(libname, pkgname)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch(fun(libname, pkgname), error = identity)
 8: runHook(".onLoad", env, package.lib, package)
 9: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
10: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()),     versionCheck = vI[[i]]), from = package)
11: loadNamespace(package, lib.loc)
12: doTryCatch(return(expr), name, parentenv, handler)
13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
14: tryCatchList(expr, classes, parentenv, handlers)
15: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, 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)})
16: library(synapser)

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

Here is my system info:

 sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin19.6.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.0.3 R6_2.5.0       pack_0.1-1
 packageVersion('synapser')
[1] ‘0.8.71’

Thanks, Gabriel

GabrielHoffman commented 3 years ago

I did a little more testing and it is a problem with PythonEmbedInR:

> packageVersion("PythonEmbedInR")
[1] ‘0.5.73’

Both of these were in fresh R sessions:

> library(PythonEmbedInR)
Loading required package: R6
Loading required package: rjson

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

Traceback:
 1: pyIsConnected()
 2: pyConnect()
 3: fun(libname, pkgname)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch(fun(libname, pkgname), error = identity)
 8: runHook(".onLoad", env, package.lib, package)
 9: loadNamespace(package, lib.loc)
10: doTryCatch(return(expr), name, parentenv, handler)
11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
12: tryCatchList(expr, classes, parentenv, handlers)
13: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, 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)})
14: library(PythonEmbedInR)

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

and

> 
> PythonEmbedInR::pyIsConnected()

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

Traceback:
 1: pyIsConnected()
 2: pyConnect()
 3: fun(libname, pkgname)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch(fun(libname, pkgname), error = identity)
 8: runHook(".onLoad", env, package.lib, package)
 9: loadNamespace(name)
10: getNamespace(ns)
11: asNamespace(ns)
12: getExportedValue(pkg, name)
13: PythonEmbedInR::pyIsConnected

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

Hi @GabrielHoffman,

Thanks for reporting this. Indeed I can repro this on Mac with a source compiled R 4.0.3 with PythonEmbedInR v 0.5.73 (but not with the previous 0.4.65, and not on a Mac with a pkg installed R 4.0.3). I'll see if I can isolate what the difference is and update this issue accordingly.

GabrielHoffman commented 3 years ago

In the meantime, is there a way to install the previous version with install_github or something else? I couldn't figure it out

Thanks

jkiang13 commented 3 years ago

@GabrielHoffman You could download the older versions of the binary packages and install them directly, e.g.

curl -O http://ran.synapse.org/bin/macosx/contrib/4.0/PythonEmbedInR_0.4.65.tgz curl -O http://ran.synapse.org/bin/macosx/contrib/4.0/synapser_0.7.64.tgz

R CMD INSTALL PythonEmbedInR_0.4.65.tgz R CMD INSTALL synapser_0.7.64.tgz

This assumes the other dependencies were already successfully installed, but I'm guessing they were if you encountered the error at this point.

Out of curiosity is there a reason you prefer not to use the binary installation of R 4.0.3? Normally you could use e.g. devtools::install_version to install an older version of a RAN package but I do not think that will work if you are using a source compiled R and want to install binary packages.

GabrielHoffman commented 3 years ago

1) Perfect, thanks.

2) Why R from source? I develop R packages so I have multiple R versions with different Bioconductor versions on my machine so I can test my code. I might be able to do this with R binaries, but I'm so used to Unix systems that I install everything from source.

jkiang13 commented 3 years ago

@GabrielHoffman

If you have a chance can you try installing the following release candidate (synapser 0.9.72) binary installation from the synapse staging RAN repo. It loads successfully for me on Mac catalina with a compiled 4.0.3 R but I'd appreciate confirmation. If it resolves this issue it will be included in the next release. e.g.

install.packages("synapser", repos=c("http://staging-ran.synapse.org", "http://cran.fhcrc.org"), type="mac.binary")

Thanks!

GabrielHoffman commented 3 years ago

It installed fine, and basic usage of the synapser package works as expected

Thanks for fixing this Gabriel

jkiang13 commented 3 years ago

The latest production release (syanpser 0.9.77) incorporates this fix. Installable from the synapse prod RAN repo e.g. install.packages("synapser", repos=c("http://ran.synapse.org", "http://cran.fhcrc.org"), type="mac.binary")