Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

10.0.2 seg fault with rpy2 #434

Closed
yang opened this Issue · 8 comments

3 participants

@yang

When I tried out RPy2 (either 2.1 or 2.2) from ipython 10.0.2, I get a seg fault, but this doesn't occur with ipython 10.0. Details below. Any ideas what's going on? Thanks in advance.

$ R --version
R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License version 2.
For more information about these matters see
http://www.gnu.org/licenses/.

$ pip install 'rpy2==2.1.9'
/home/yang/env/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/req.py:641:
UserWarning: Unbuilt egg for mining [unknown version]
(/home/yang/pod/mining)
 self.satisfied_by = pkg_resources.get_distribution(self.req)
Downloading/unpacking rpy2==2.1.9
 Downloading rpy2-2.1.9.tar.gz (129Kb): 129Kb downloaded
 Running setup.py egg_info for package rpy2
   Configuration for R as a library:
     include_dirs: ('/usr/share/R/include',)
     libraries: ('lapack', 'blas', 'R')
     library_dirs: ('/usr/lib64/R/lib',)
     extra_link_args: ()
    # OSX-specific (included in extra_link_args)
     framework_dirs: ()
     frameworks: ()
Installing collected packages: rpy2
 Running setup.py install for rpy2
   Configuration for R as a library:
     include_dirs: ('/usr/share/R/include',)
     libraries: ('lapack', 'blas', 'R')
     library_dirs: ('/usr/lib64/R/lib',)
     extra_link_args: ()
    # OSX-specific (included in extra_link_args)
     framework_dirs: ()
     frameworks: ()
   building 'rpy2.rinterface.rinterface' extension
   gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1
-DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -Irpy/rinterface
-I/usr/include/python2.6 -I/usr/share/R/include -c
rpy/rinterface/rinterface.c -o
build/temp.linux-x86_64-2.6/rpy/rinterface/rinterface.o
   In file included from /usr/include/python2.6/Python.h:8,
                    from rpy/rinterface/rinterface.c:55:
   /usr/include/python2.6/pyconfig.h:1031:1: warning:
"_POSIX_C_SOURCE" redefined
   In file included from /usr/include/signal.h:29,
                    from rpy/rinterface/rinterface.c:51:
   /usr/include/features.h:210:1: warning: this is the location of
the previous definition
   In file included from rpy/rinterface/rinterface.c:62:
   /usr/share/R/include/Rinternals.h:657: warning: function
declaration isn’t a prototype
   In file included from rpy/rinterface/rinterface.c:74:
   /usr/share/R/include/R_ext/Rdynload.h:26: warning: function
declaration isn’t a prototype
   In file included from rpy/rinterface/rinterface.c:105:
   rpy/rinterface/sequence.c: In function ‘VectorSexp_ass_slice’:
   rpy/rinterface/sequence.c:447: warning: unused variable ‘sexp_item’
   rpy/rinterface/sequence.c:447: warning: unused variable ‘tmp’
   rpy/rinterface/sequence.c:446: warning: unused variable ‘vs’
   rpy/rinterface/sequence.c:386: warning: unused variable ‘self_typeof’
   rpy/rinterface/rinterface.c: In function ‘EmbeddedR_end’:
   rpy/rinterface/rinterface.c:1112: warning: unused variable ‘str’
   rpy/rinterface/rinterface.c: In function ‘EnvironmentSexp_ass_subscript’:
   rpy/rinterface/rinterface.c:2001: warning: unused variable ‘sexp_copy’
   rpy/rinterface/rinterface.c: At top level:
   rpy/rinterface/rinterface.c:2775: warning: ‘externalMethods’
defined but not used
   rpy/rinterface/rinterface.c: In function ‘EmbeddedR_ShowFiles’:
   rpy/rinterface/rinterface.c:654: warning: ‘gstate’ may be used
uninitialized in this function
   rpy/rinterface/rinterface.c: In function ‘EmbeddedR_FlushConsole’:
   rpy/rinterface/rinterface.c:524: warning: ‘gstate’ may be used
uninitialized in this function
   rpy/rinterface/rinterface.c: In function ‘EmbeddedR_ChooseFile’:
   rpy/rinterface/rinterface.c:568: warning: ‘gstate’ may be used
uninitialized in this function
   rpy/rinterface/rinterface.c: In function ‘EmbeddedR_ReadConsole’:
   rpy/rinterface/rinterface.c:424: warning: ‘gstate’ may be used
uninitialized in this function
   rpy/rinterface/rinterface.c: In function ‘EmbeddedR_WriteConsole’:
   rpy/rinterface/rinterface.c:288: warning: ‘gstate’ may be used
uninitialized in this function
   rpy/rinterface/rinterface.c: In function ‘EmbeddedR_ShowMessage’:
   rpy/rinterface/rinterface.c:356: warning: ‘gstate’ may be used
uninitialized in this function
   rpy/rinterface/rinterface.c: In function ‘EmbeddedR_CleanUp’:
   rpy/rinterface/rinterface.c:787: warning: ‘gstate’ may be used
uninitialized in this function
   gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
build/temp.linux-x86_64-2.6/rpy/rinterface/rinterface.o
-L/usr/lib64/R/lib -L/usr/lib64/R/modules -lR -llapack -lblas -lR -o
build/lib.linux-x86_64-2.6/rpy2/rinterface/rinterface.so
   building 'rpy2.rinterface.rpy_device' extension
   gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1
-DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -Irpy/rinterface
-I/usr/include/python2.6 -I/usr/share/R/include -c
rpy/rinterface/rpy_device.c -o
build/temp.linux-x86_64-2.6/rpy/rinterface/rpy_device.o
   In file included from rpy/rinterface/rpy_device.c:6:
   /usr/share/R/include/Rinternals.h:657: warning: function
declaration isn’t a prototype
   rpy/rinterface/rpy_device.c:690: warning: ‘GrDev_clear’ defined but not used
   gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
build/temp.linux-x86_64-2.6/rpy/rinterface/rpy_device.o
-L/usr/lib64/R/lib -L/usr/lib64/R/modules -lR -llapack -lblas -lR -o
build/lib.linux-x86_64-2.6/rpy2/rinterface/rpy_device.so
Successfully installed rpy2

$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpy2.robjects
>>>

$ ipython
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
Type "copyright", "credits" or "license" for more information.

IPython 0.10.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import rpy2.robjects
Segmentation fault

$ pip install --upgrade 'rpy2'
Downloading/unpacking rpy2
 Downloading rpy2-2.2.0beta3.tar.gz (164Kb): 164Kb downloaded
 Running setup.py egg_info for package rpy2
   Configuration for R as a library:
     include_dirs: ('/usr/share/R/include',)
     libraries: ('lapack', 'blas', 'R')
     library_dirs: ('/usr/lib64/R/lib',)
     extra_link_args: ()
    # OSX-specific (included in extra_link_args)
     framework_dirs: ()
     frameworks: ()
Installing collected packages: rpy2
 Found existing installation: rpy2 2.1.9-20110510
   Uninstalling rpy2:
     Successfully uninstalled rpy2
 Running setup.py install for rpy2
   Configuration for R as a library:
     include_dirs: ('/usr/share/R/include',)
     libraries: ('lapack', 'blas', 'R')
     library_dirs: ('/usr/lib64/R/lib',)
     extra_link_args: ()
    # OSX-specific (included in extra_link_args)
     framework_dirs: ()
     frameworks: ()
   building 'rpy2.rinterface._rinterface' extension
   gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1
-DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -I./rpy/rinterface
-I/usr/include/python2.6 -I/usr/share/R/include -c
./rpy/rinterface/_rinterface.c -o
build/temp.linux-x86_64-2.6/./rpy/rinterface/_rinterface.o
   In file included from /usr/include/python2.6/Python.h:8,
                    from ./rpy/rinterface/_rinterface.c:55:
   /usr/include/python2.6/pyconfig.h:1031:1: warning:
"_POSIX_C_SOURCE" redefined
   In file included from /usr/include/signal.h:29,
                    from ./rpy/rinterface/_rinterface.c:51:
   /usr/include/features.h:210:1: warning: this is the location of
the previous definition
   In file included from ./rpy/rinterface/_rinterface.c:63:
   /usr/share/R/include/Rinternals.h:657: warning: function
declaration isn’t a prototype
   In file included from ./rpy/rinterface/_rinterface.c:74:
   /usr/share/R/include/R_ext/Rdynload.h:26: warning: function
declaration isn’t a prototype
   In file included from ./rpy/rinterface/_rinterface.c:122:
   ./rpy/rinterface/sequence.c: In function ‘VectorSexp_ass_slice’:
   ./rpy/rinterface/sequence.c:542: warning: unused variable ‘sexp_item’
   ./rpy/rinterface/sequence.c:542: warning: unused variable ‘tmp’
   ./rpy/rinterface/sequence.c:541: warning: unused variable ‘vs’
   ./rpy/rinterface/sequence.c:478: warning: unused variable ‘self_typeof’
   ./rpy/rinterface/sequence.c: In function ‘RPy_SeqToINTSXP’:
   ./rpy/rinterface/sequence.c:1193: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c:1202: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c: In function ‘RPy_IterToINTSXP’:
   ./rpy/rinterface/sequence.c:1241: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c:1261: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c:1270: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c: In function ‘RPy_SeqToREALSXP’:
   ./rpy/rinterface/sequence.c:1425: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c: In function ‘RPy_IterToREALSXP’:
   ./rpy/rinterface/sequence.c:1461: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c:1474: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c: In function ‘RPy_SeqToSTRSXP’:
   ./rpy/rinterface/sequence.c:1631: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c:1661: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c: In function ‘RPy_SeqToLGLSXP’:
   ./rpy/rinterface/sequence.c:1838: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c: In function ‘RPy_SeqToRAWSXP’:
   ./rpy/rinterface/sequence.c:1991: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c:1997: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c: In function ‘RPy_SeqToCPLXSXP’:
   ./rpy/rinterface/sequence.c:2133: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/sequence.c: In function ‘RPy_SeqToVECSXP’:
   ./rpy/rinterface/sequence.c:2330: warning: format ‘%i’ expects
type ‘int’, but argument 3 has type ‘Py_ssize_t’
   ./rpy/rinterface/_rinterface.c:2172:11: warning: extra tokens at
end of #endif directive
   ./rpy/rinterface/_rinterface.c: At top level:
   ./rpy/rinterface/sequence.c:2144: warning:
‘ComplexVectorSexp_AsSexp’ defined but not used
   ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ShowFiles’:
   ./rpy/rinterface/_rinterface.c:738: warning: ‘gstate’ may be used
uninitialized in this function
   ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_FlushConsole’:
   ./rpy/rinterface/_rinterface.c:592: warning: ‘gstate’ may be used
uninitialized in this function
   ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ChooseFile’:
   ./rpy/rinterface/_rinterface.c:636: warning: ‘gstate’ may be used
uninitialized in this function
   ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ReadConsole’:
   ./rpy/rinterface/_rinterface.c:460: warning: ‘gstate’ may be used
uninitialized in this function
   ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_WriteConsole’:
   ./rpy/rinterface/_rinterface.c:318: warning: ‘gstate’ may be used
uninitialized in this function
   ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ShowMessage’:
   ./rpy/rinterface/_rinterface.c:392: warning: ‘gstate’ may be used
uninitialized in this function
   ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_CleanUp’:
   ./rpy/rinterface/_rinterface.c:886: warning: ‘gstate’ may be used
uninitialized in this function
   gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
build/temp.linux-x86_64-2.6/./rpy/rinterface/_rinterface.o
-L/usr/lib64/R/lib -L/usr/lib64/R/modules -lR -llapack -lblas -lR -o
build/lib.linux-x86_64-2.6/rpy2/rinterface/_rinterface.so
   building 'rpy2.rinterface.rpy_device' extension
   gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1
-DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -Irpy/rinterface
-I/usr/include/python2.6 -I/usr/share/R/include -c
rpy/rinterface/rpy_device.c -o
build/temp.linux-x86_64-2.6/rpy/rinterface/rpy_device.o
   In file included from rpy/rinterface/rpy_device.c:33:
   /usr/share/R/include/Rinternals.h:657: warning: function
declaration isn’t a prototype
   rpy/rinterface/rpy_device.c:789: warning: ‘GrDev_clear’ defined but not used
   gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
build/temp.linux-x86_64-2.6/rpy/rinterface/rpy_device.o
-L/usr/lib64/R/lib -L/usr/lib64/R/modules -lR -llapack -lblas -lR -o
build/lib.linux-x86_64-2.6/rpy2/rinterface/rpy_device.so
Successfully installed rpy2
Cleaning up...

yang@partycat Tue May 10 16:20:42 ~/pod/sales git(master)
$ ipython
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
Type "copyright", "credits" or "license" for more information.

IPython 0.10.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import rpy2.robjects
Segmentation fault
@fperez
Owner
@takluyver
Owner

For info (I'm subscribed to the rpy-dev list as well), this is almost certainly a tricky problem in rpy2 - there are somewhat inconsistent segfaults that seem to trigger on some systems but not others. And where segfaults can be reproduced, they can (at least in some cases) be reproduced outside of IPython.

So I think something IPython is doing is triggering the bug for @yang, but the bug itself is in rpy2.

@fperez
Owner

I think you're right, @takluyver, I'm closing this one. Thanks for the info.

@fperez fperez closed this
@yang

I retried a few times and so far it has been 100% in ipython, 0% in python.

@takluyver
Owner

Other people can trigger segfaults in various situations without IPython (see Artur's t.py script). So my money's certainly on rpy2, at least until those segfaults are fixed.

Also, IPython is 100% Python code, and any segfault indicates a bug in C code - either rpy2, or CPython itself.

@fperez
Owner
@yang

Thanks for both your answers. What you say makes sense. Sorry for sounding like I was trying to blame ipython - just reporting back what I seemed to be finding (more "FWIW"/for posterity than anything). Hopefully the rpy folks can help resolve this.

@fperez
Owner
@damianavila damianavila referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.