caught segfault error when loading S4Vectors package in R
1
0
Entering edit mode
ecg1g15 ▴ 20
@ecg1g15-19970
Last seen 3.4 years ago

Hi,

I am a macOS user. I am using the shell terminal to run a bash script from a pipeline, the script is linked to an R script, and when I run it I get the error below. From what I could figure out, the problem seems to be that R crashes/breaks when it is trying to load the library(S4Vectors) package. I have installed that package as stated on https://bioconductor.org/packages/release/bioc/html/S4Vectors.html and seemed to be fine. I have also uninstalled all R/R studio versions and installed the latest one, and did the same with all R packages, but I still ave the same error. Has anybody seen this before, or could give me a hand with this? Thanks,

Elena

Working directory is  /Volumes/ECG_WORK/JC150_T0/results/step_5_output/RefSeq_results/org_results 
Loading required package: S4Vectors
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: ‘BiocGenerics’

The following objects are masked from ‘package:parallel’:

clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from ‘package:stats’:

IQR, mad, sd, var, xtabs

The following objects are masked from ‘package:base’:

anyDuplicated, append, as.data.frame, basename, cbind, colMeans,
colnames, colSums, dirname, do.call, duplicated, eval, evalq,
Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply,
lengths, Map, mapply, match, mget, order, paste, pmax, pmax.int,
pmin, pmin.int, Position, rank, rbind, Reduce, rowMeans, rownames,
rowSums, sapply, setdiff, sort, table, tapply, union, unique,
unsplit, which, which.max, which.min

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

Traceback:
 1: dyn.load(file, DLLpath = DLLpath, ...)
 2: library.dynam(lib, package, package.lib)
 3: loadNamespace(package, lib.loc)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: 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)})
 8: library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc,     quietly = quietly)
 9: .getRequiredPackages2(pkgInfo, quietly = quietly)
10: library(DESeq2)
An irrecoverable exception occurred. R is aborting now ...
R S4Vectors segfault • 2.1k views
ADD COMMENT
1
Entering edit mode

Make sure that your installed packages are from the same release; either

BiocManager::valid()         # current release

or

BiocInstaller::biocValid()   # older versions

It's not clear from your output why you think this is S4Vector's problem?

ADD REPLY
0
Entering edit mode

Hi,

The reason why it seems to be a problem with the S4Vector is that when I run

> library(S4Vectors)

on the terminal, it shows that exact same error, whereas when I load

> library(stats4)

, BiocGenerics or parallel, they load fine.

Thanks for the recommendation on

 BiocManager::valid()

as it seemed that 24 packages were out of date, I guess I didn't use the same release? and installed using the following command: although it seems that three packages cannot install through Bioconductors as they have errors.

> BiocManager::install(c(  "httpuv", "RJSONIO", "stringi" ), update = TRUE, ask = FALSE)
ERROR: configuration failed for package ‘stringi’
ERROR: compilation failed for package ‘httpuv’
ERROR: configuration failed for package ‘RJSONIO’

How can I update those packages with Bioconductors? they don't seem to be in your https://bioconductor.org/packages/

Thanks,

E

ADD REPLY
1
Entering edit mode

The packages are CRAN packages. Normally, they can be updated with BiocManager, but likely these packages have system or other dependencies that are preventing their re-installation. The strategy is to try installing each individually and identifying what the problem is. If a 'configure' script runs and reports something like 'libuv-dev' not found, then your task becomes finding and installing those system dependencies, typically through your operating system package manager.

But before doing that, these are unlikely to be the problem, so I'd go back to S4Vectors and 'try again'. If there are still problems, then you'll want to investigate some more. I'd start by making sure you are in a new R session, and that there are no additional packages loaded. Print the output of sessionInfo(); I have

> sessionInfo()
R Under development (unstable) (2019-02-19 r76128)
Platform: x86_64-apple-darwin17.7.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /Users/ma38727/bin/R-devel/lib/libRblas.dylib
LAPACK: /Users/ma38727/bin/R-devel/lib/libRlapack.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_3.6.0

After I load S4Vectors, I have

> sessionInfo()
R Under development (unstable) (2019-02-19 r76128)
Platform: x86_64-apple-darwin17.7.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /Users/ma38727/bin/R-devel/lib/libRblas.dylib
LAPACK: /Users/ma38727/bin/R-devel/lib/libRlapack.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] parallel  stats4    stats     graphics  grDevices utils     datasets
[8] methods   base

other attached packages:
[1] S4Vectors_0.21.10   BiocGenerics_0.29.1

loaded via a namespace (and not attached):
[1] compiler_3.6.0 tools_3.6.0

So that in addition to S4Vectors, I have BiocGenerics and other packages loaded or attached; I guess you'll make some progress, and either BiocGenerics or S4Vectors will be problematic; I would suggest re-installing both via BiocManager.

The output of sessionInfo() is helpful in diagnosing problems, so it would be good to include that if you need further help.

ADD REPLY
0
Entering edit mode

Hi,

After re-installing the packages, when loading library(S4Vectors) seems to be OK after doing what you said (it does not show the error like it did at the beginning).Also loaded the packages "needed" from the initial error stats4, parallel, and BiocGeneric.

Here my current

sessionInfo()
    R version 3.5.1 (2018-07-02)
    Platform: x86_64-apple-darwin13.4.0 (64-bit)
    Running under: macOS  10.14.3

Matrix products: default
BLAS/LAPACK: /Users/ecg1g15/miniconda3/envs/py2/lib/R/lib/libRblas.dylib

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

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

other attached packages:
[1] S4Vectors_0.20.1    BiocGenerics_0.28.0

loaded via a namespace (and not attached):
[1] compiler_3.5.1

But after re-loading the S4vectors with the BiocManager, it says :

> The downloaded source packages are in
>   ‘/private/var/folders/cw/f68f84_d41sbtj8flvsls8mxljrs1s/T/Rtmpf7VBGb/downloaded_packages’
> Update old packages: 'httpuv', 'RJSONIO', 'stringi' 
> Update all/some/none? [a/s/n]:

And here is where I say "yes" and find the errors again.

**** (pasted only the error messages as it seems to be long output)
ERROR: configuration failed for package ‘stringi’
ERROR: compilation failed for package ‘httpuv’
ERROR: configuration failed for package ‘RJSONIO’
****

1: In install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  installation of package ‘httpuv’ had non-zero exit status
2: In install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  installation of package ‘RJSONIO’ had non-zero exit status
3: In install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  installation of package ‘stringi’ had non-zero exit status

When I run the script, I still have the initial error... Maybe there is something going on with those messages?

The following object is masked from ‘package:base’:

But happy I got the S4Vectors working now, one step at a time ;)

ADD REPLY
0
Entering edit mode

Hi again @Martin

I have tried re-installing all the packages from scratch using Bioconductors, and loading them (S4Vectors... etc).

The actual problem comes when after installing it, I load "DESeq2" Then R crashes and forces the program to abort/exit. From what I can see on the initial error, seems like DESeq could need some "getRequiredPackages2" ? I am sure the DESeq2 version you have on the https://www.bioconductor.org/packages/release/bioc/html/DESeq2.html is the latest one?

I have now installed all though bioconductor so shouldn't be a problem of having all packages installed form different sources?

Let me know what you think,

thanks a lot

Elena

ADD REPLY
1
Entering edit mode

In some ways I do not have a clear answer. You can try the following to start to narrow down to the specific package causing problems. From the traceback, you can 'see' that the code calls library.dynam() (load C or C++ code from a package). One of the arguments to library.dynam() is package. You can convince R to print the value of the package argument each time library.dynam() is called using the trace() function. So start R, trace library.dynam, and try loading DESeq2.

trace(library.dynam, quote(print(package)))
library(DESeq2)

R will load libraries until it encounters an error; the last library printed will be the one causing problems. For me, with no problems, I see

> library(DESeq2)
Loading required package: S4Vectors
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel
Tracing library.dynam(lib, package, package.lib) on entry
[1] "parallel"

Attaching package: ‘BiocGenerics’
...  ## lots of stuff removed from the display...
Tracing library.dynam(lib, package, package.lib) on entry
[1] "genefilter"
Tracing library.dynam(lib, package, package.lib) on entry
[1] "locfit"
Tracing library.dynam(lib, package, package.lib) on entry
[1] "DESeq2"
>

A number of packages have C or C++ code, and for me all of them load without error.

ADD REPLY
0
Entering edit mode

You should try to install just httpuv

BiocManager::install("httpuv")

and examine the reason it fails to install. The messages about 'object is masked...' is not important in this context.

ADD REPLY
0
Entering edit mode

Thanks Martin, I have tried installing httpuv, stringis and RJSONIO with the Biocmanager command using mac terminal and it shows the same error as when updating them:

* installing *source* package ‘httpuv’ ...
** package ‘httpuv’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang++ -std=gnu++11 -I"/Users/ecg1g15/miniconda3/envs/py2/lib/R/include" -DNDEBUG -pthread -I"/Users/ecg1g15/Library/R/3.5/library/Rcpp/include" -I"/Users/ecg1g15/Library/R/3.5/library/BH/include" -I"/Users/ecg1g15/Library/R/3.5/library/later/include" -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/ecg1g15/miniconda3/envs/py2/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden  -fmessage-length=0 -I/Users/ecg1g15/miniconda3/envs/py2/include -fdebug-prefix-map==/usr/local/src/conda/- -fdebug-prefix-map==/usr/local/src/conda-prefix -c RcppExports-legacy.cpp -o RcppExports-legacy.o
In file included from RcppExports-legacy.cpp:23:
In file included from /Users/ecg1g15/Library/R/3.5/library/Rcpp/include/Rcpp.h:27:
In file included from /Users/ecg1g15/Library/R/3.5/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/ecg1g15/Library/R/3.5/library/Rcpp/include/Rcpp/r/headers.h:59:
In file included from /Users/ecg1g15/Library/R/3.5/library/Rcpp/include/Rcpp/platform/compiler.h:100:
In file included from /Users/ecg1g15/miniconda3/envs/py2/bin/../include/c++/v1/cmath:305:
/Users/ecg1g15/miniconda3/envs/py2/bin/../include/c++/v1/math.h:301:15: fatal error: 'math.h' file not found
#include_next <math.h>
              ^~~~~~~~
1 error generated.
make: *** [/Users/ecg1g15/miniconda3/envs/py2/lib/R/etc/Makeconf:167: RcppExports-legacy.o] Error 1
**ERROR: compilation failed for package ‘httpuv’**
* removing ‘/Users/ecg1g15/Library/R/3.5/library/httpuv’
* restoring previous ‘/Users/ecg1g15/Library/R/3.5/library/httpuv’

The downloaded source packages are in
    ‘/private/var/folders/cw/f68f84_d41sbtj8flvsls8mxljrs1s/T/RtmpwgZpqn/downloaded_packages’
Update old packages: 'httpuv', 'RJSONIO', 'stringi'
Update all/some/none? [a/s/n]: history >

However, when I use it directly on R console, it does allow me to install them without problems, but again the error shows when loading library(DESeq2)... and forces R to abort the session.

ADD REPLY
2
Entering edit mode
@martin-morgan-1513
Last seen 2 days ago
United States

I'll start an answer, since we're getting closer. I'm not sure what you mean by 'mac terminal' versus 'R console', but...

make: *** [/Users/ecg1g15/miniconda3/envs/py2/lib/R/etc/Makeconf:167: RcppExport

suggests that you have used a conda environment to install some packages. Now you are using 'standard' R. Mixing these two installation mechanisms is causing problems, and the solution is to pick one and stick with it. I don't know how to 'undo' the mixed installation.

Personally, I would use 'standard' R, downloading and installing R from https://r-project.org and installing packages using BiocManager::install(). By default, the macOS installs the 'binary' version of packages, so most packages will install without problem.

If you were to opt instead for conda, then I think instructions like those at https://support.bioconductor.org/p/118241/#118265 will work. The conda approach is probably easier in the short term, but limited in the long term (e.g., when you want to install a package that is not in conda). I don't have direct experience with conda.

I'm also not sure about the difference between 'mac terminal' and 'R console'; I suspect that one has set environment variables (e.g., RLIBSUSER and .libPaths()) differently than the other. Again I'm not sure how to debug this remotely, but maybe the general notion of different environment variables helps.

ADD COMMENT
0
Entering edit mode

Hi @Martin,

I ended up fixing this I believe! (now I have different errors but nothing to do with this!)

So, yes you are right, I have used two different ways of installing packages (CRAN on R, and bioconductors on shell terminal), the problem comes when it's trying to load the DESeq2 package, and S4vectors was only one of the included packages when you install DESeq2.

Apologies with my terminology, when I am speaking about R console nd mac terminal. R console means directly on the standard R program, and running the install.packages() and BiocManager::install() , whereas when I use the shell terminal on mac (standard terminal) I can activate R and then I was using the BiocManager::install(). For some reason I installed the packages on both and as you said, it seemed to be crashing.

SO the way I fixed this:

  1. Uninstall all packages from Rstudio
  2. Uninstall R and R studio (maybe not needed but just to make sure I had all latest version)
  3. Re-install R and R studio (to make sure I would have the default packages)
  4. Re-install the desired packages using BiocManager::install() directly in R.

And it worked! Thanks again!

ADD REPLY

Login before adding your answer.

Traffic: 450 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6