Python, R and rpy2 c-stack too close to the limit

2019-08-20 04:18发布

Edit: I have seen a few answers to this question for people working in UNIX based systems but I am working in windows so I don't think these will work.

I am trying to call R from Python via the rpy2 package, everything seemed to be working fine and then one day I started to get his error, just trying to import rpy2 packages. The code is simply:

from rpy2 import robjects as r
from rpy2.robjects.packages import importr
from rpy2.robjects.vectors import DataFrame
from rpy2.robjects import Formula 
from rpy2.robjects import pandas2ri

And the error message I get is:

Error: C stack usage 24382064 is too close to the limit

Things I've tried so far are:

  • Running the file with a random, non rpy2 related import statement, the error does not appear in this case
  • I tried to think of a way of turning c-stack checking off from within R (i.e. using R_CStackLimit = -1) but I think this needs to be done for every R session, and as I can't connect to R at all without getting the error I can't send any commands to R.

Would really appreciate some advice, I've been trying to work this out for days and got pretty much nowhere.

Tim

标签: python r rpy2
0条回答
登录 后发表回答