rpy2 Segmentation Fault when packaged with cx_Freeze (MacOS X)

Issue #186 new
Martin Fitzpatrick created an issue

A packaged app importing 'rpy2' (availabe on PyPi) results in a segmentation fault. It fails on:

import rpy2.robjects as robjects

But using breakpoints I find that the actual error occurs in rpy2/robjects/robjects/robjects.py on line 5 rpy2.rinterface.initr(). This (I believe) is a call into the _rinterface.so file in rpy2/robjects/rinterface

The traceback is:

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000054d8

VM Regions Near 0x54d8:
--> 
    __TEXT                 000000010d2da000-000000010d2dc000 [    8K] r-x/rwx SM=COW  /Users/USER/*/Pathomx-2.3.0.app/Contents/MacOS/Pathomx

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libR.dylib                      0x000000011e64341c Rf_install + 188 (names.c:1103)
1   methods.so                      0x000000011e013967 R_initMethodDispatch + 87
2   libR.dylib                      0x000000011d924d05 do_dotcall + 469
3   libR.dylib                      0x000000011d94f7ce bcEval + 9454
4   libR.dylib                      0x000000011d94cd2b Rf_eval + 251
5   libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
6   libR.dylib                      0x000000011d94f5fe bcEval + 8990
7   libR.dylib                      0x000000011d94cd2b Rf_eval + 251
8   libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
9   libR.dylib                      0x000000011d94f5fe bcEval + 8990
10  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
11  libR.dylib                      0x000000011d9569b3 forcePromise + 147
12  libR.dylib                      0x000000011d9574d4 getvar + 452
13  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
14  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
15  libR.dylib                      0x000000011d9569b3 forcePromise + 147
16  libR.dylib                      0x000000011d9574d4 getvar + 452
17  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
18  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
19  libR.dylib                      0x000000011d9569b3 forcePromise + 147
20  libR.dylib                      0x000000011d9574d4 getvar + 452
21  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
22  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
23  libR.dylib                      0x000000011d9569b3 forcePromise + 147
24  libR.dylib                      0x000000011d9574d4 getvar + 452
25  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
26  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
27  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
28  libR.dylib                      0x000000011d94f5fe bcEval + 8990
29  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
30  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
31  libR.dylib                      0x000000011d94f5fe bcEval + 8990
32  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
33  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
34  libR.dylib                      0x000000011d94f5fe bcEval + 8990
35  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
36  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
37  libR.dylib                      0x000000011d94f5fe bcEval + 8990
38  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
39  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
40  libR.dylib                      0x000000011d94f5fe bcEval + 8990
41  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
42  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
43  libR.dylib                      0x000000011d94f5fe bcEval + 8990
44  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
45  libR.dylib                      0x000000011d9569b3 forcePromise + 147
46  libR.dylib                      0x000000011d9574d4 getvar + 452
47  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
48  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
49  libR.dylib                      0x000000011d9569b3 forcePromise + 147
50  libR.dylib                      0x000000011d9574d4 getvar + 452
51  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
52  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
53  libR.dylib                      0x000000011d9569b3 forcePromise + 147
54  libR.dylib                      0x000000011d9574d4 getvar + 452
55  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
56  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
57  libR.dylib                      0x000000011d9569b3 forcePromise + 147
58  libR.dylib                      0x000000011d9574d4 getvar + 452
59  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
60  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
61  libR.dylib                      0x000000011d9569b3 forcePromise + 147
62  libR.dylib                      0x000000011d9574d4 getvar + 452
63  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
64  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
65  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
66  libR.dylib                      0x000000011d94f5fe bcEval + 8990
67  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
68  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
69  libR.dylib                      0x000000011d94f5fe bcEval + 8990
70  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
71  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
72  libR.dylib                      0x000000011d94f5fe bcEval + 8990
73  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
74  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
75  libR.dylib                      0x000000011d94f5fe bcEval + 8990
76  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
77  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
78  libR.dylib                      0x000000011d94f5fe bcEval + 8990
79  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
80  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
81  libR.dylib                      0x000000011d94f5fe bcEval + 8990
82  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
83  libR.dylib                      0x000000011d9569b3 forcePromise + 147
84  libR.dylib                      0x000000011d9574d4 getvar + 452
85  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
86  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
87  libR.dylib                      0x000000011d9569b3 forcePromise + 147
88  libR.dylib                      0x000000011d9574d4 getvar + 452
89  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
90  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
91  libR.dylib                      0x000000011d9569b3 forcePromise + 147
92  libR.dylib                      0x000000011d9574d4 getvar + 452
93  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
94  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
95  libR.dylib                      0x000000011d9569b3 forcePromise + 147
96  libR.dylib                      0x000000011d9574d4 getvar + 452
97  libR.dylib                      0x000000011d94e4a5 bcEval + 4549
98  libR.dylib                      0x000000011d94cd2b Rf_eval + 251
99  libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
100 libR.dylib                      0x000000011d94f5fe bcEval + 8990
101 libR.dylib                      0x000000011d94cd2b Rf_eval + 251
102 libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
103 libR.dylib                      0x000000011d94f5fe bcEval + 8990
104 libR.dylib                      0x000000011d94cd2b Rf_eval + 251
105 libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
106 libR.dylib                      0x000000011d94f5fe bcEval + 8990
107 libR.dylib                      0x000000011d94cd2b Rf_eval + 251
108 libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
109 libR.dylib                      0x000000011d94f5fe bcEval + 8990
110 libR.dylib                      0x000000011d94cd2b Rf_eval + 251
111 libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
112 libR.dylib                      0x000000011d94d173 Rf_eval + 1347
113 libR.dylib                      0x000000011d9595c7 do_set + 343
114 libR.dylib                      0x000000011d94cf44 Rf_eval + 788
115 libR.dylib                      0x000000011d959920 do_begin + 384
116 libR.dylib                      0x000000011d94cf44 Rf_eval + 788
117 libR.dylib                      0x000000011d94cf44 Rf_eval + 788
118 libR.dylib                      0x000000011d959920 do_begin + 384
119 libR.dylib                      0x000000011d94cf44 Rf_eval + 788
120 libR.dylib                      0x000000011d95720e Rf_applyClosure + 1422
121 libR.dylib                      0x000000011d94d173 Rf_eval + 1347
122 libR.dylib                      0x000000011d97a426 setup_Rmainloop + 1558
123 rpy2.rinterface._rinterface.so  0x000000011d89a9f6 EmbeddedR_init + 374
124 Python                          0x000000010d42978c PyEval_EvalFrameEx + 12770
125 Python                          0x000000010d426480 PyEval_EvalCodeEx + 1638
126 Python                          0x000000010d425e14 PyEval_EvalCode + 54

Importing in a non-packaged app works as expected.

Since this may be an issue with cx_Freeze instead I've also opened a bug here.

Comments (1)

  1. Laurent Gautier

    Do you get the same with only:

    import rpy2.rinterface as ri
    ri.initr()
    

    ?

    Otherwise the problem seems to be occuring when running setup_Rmainloop(), which belongs to R.

  2. Log in to comment