Mac OSX - Segfaults

Issue #127 duplicate
Chad Fulton created an issue

Mac OSX 10.8.3, Python 2.7.2, rpy2 (version 2.2.2 or 2.3.5), R 3.0.0

$ python

Python 2.7.2 (default, Oct 19 2011, 16:29:46) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information.

.>>> import rpy2.robjects as robjects

.>>> pi = robjects.r['pi']

Segmentation fault: 11


$ python -m 'rpy2.tests'

rpy2 version: 2.3.5

built against R version: 3-0.0--62481

Segmentation fault: 11


$ python

Python 2.7.2 (default, Oct 19 2011, 16:29:46) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information.

.>>> import rpy2.tests

Segmentation fault: 11

Comments (13)

  1. Laurent Gautier

    This has been reported to happen on OS X when R was updated without re-installing rpy2. Can you check whether re-installing rpy2 would help ?

  2. Chad Fulton reporter

    I removed rpy2 (installed via pip) and reinstalled, but that didn't help. I also removed python itself (via brew) and reinstalled / updated it to python 2.7.3, which also didn't help.

    A stack trace on all of the segfaults above reveals that the last line before the segfault is line 79 in

    rpy/robjects/_ _ init _ _.py
    

    I'll attached the simplest stack trace to the issue, which is from calling

    pi = robjects.r['pi']
    

    I'll try re-installing R, and then reinstalling rpy2, and see if that helps.

  3. Laurent Gautier

    When running in a console python -m rpy2.tests, do the version numbers displayed match your R version ?

  4. Chad Fulton reporter

    At least the major versions match:

    $ python -m rpy2.tests
    rpy2 version: 2.3.5
    built against R version: 3-0.0--62481
    Segmentation fault: 11
    
    $ R
    
    R version 3.0.0 (2013-04-03) -- "Masked Marvel"
    Copyright (C) 2013 The R Foundation for Statistical Computing
    Platform: x86_64-apple-darwin10.8.0 (64-bit)
    

    I'm not sure about the R build number though. I installed R 3.0.0 (before I'd ever installed rpy2) from the CRAN R package, so whichever build number that is.

  5. Chad Fulton reporter

    Removing and reinstalling R helped, now I get:

    $  python -m rpy2.tests
    rpy2 version: 2.3.5
    built against R version: 3-0.0--62481
    Error in loadNamespace(name) : there is no package called ‘ggplot2’
    .......................................Segmentation fault: 11
    

    And I can now run

    import rpy2.tests
    

    without a segfault.

    But I still get

    >>> import rpy2.robjects as robjects
    >>> pi = robjects.r['pi']
    Segmentation fault: 11
    

    And the stack trace shows the same problems as before (ending on line 79, etc.).

  6. Chad Fulton reporter

    Removing R and rpy2 and reinstalling R 2-15.3 gave the same results as when I reinstalled R 3.0.0:

    $  python -m rpy2.tests
    rpy2 version: 2.3.5
    built against R version: 2-15.3--4488866274
    Error in loadNamespace(name) : there is no package called ‘ggplot2’
    .......................................Segmentation fault: 11
    
  7. Laurent Gautier

    The SVN revision 62481 is corresponding to the release 3.0.0, so that's matching exactly...

    Is llvm-gcc or clang used during the compilation ? The former is the default on OS X, I am reading, and is reported to lead problems with Python - clang is the recommended workaround.

  8. Chad Fulton reporter

    I have gotten a working version of rpy2 by installing version 2.3.4. Here are some additional notes:

    • rpy2 2.3.5 and 2.2.2 give me the same segfault (as above)
    • The same results apply to Python versions 2.7.2 and 2.7.3
    • rpy2 2.3.4 works (I haven't tested anything else in between 2.2.2 and 2.3.5, but I'd be happy to test other versions if that'd be helpful)
    • It was compiling with llvm-gcc, but running CC=clang pip install rpy2 still segfaults with either 2.2.2 or 2.3.5
    • rpy2 2.3.4 works whether it is compiled with llvm-gcc or clang
    • I tested all of this with R versions 2.15.3 and 3.0.0

    Thanks for your help on this.

    Edit: by "works", I mean it passes python -m rpy2.tests. I'll test it out further to see if it holds up.

  9. Denis A Engemann

    @fulton thanks for the inquiry, I had exactly the same issue on OS X 10.8.4 and got the same results, switching to the rpy2 2.3.x branch did the trick.

  10. Log in to comment