在 Linux 上通过 Rpy 运行时出现 R 段错误
我在 redhat linux 发行版上通过 Rpy 运行 R。我会定期遇到此错误消息:
*** caught segfault ***
address (nil), cause 'unknown'
整个程序就在那里死掉。当我运行大量回归r.lm()
时,通常会发生这种情况。但是,只需再次运行相同的代码,问题可能会也可能不会消失(因此并不总是可重现)。有谁知道可能导致这种情况的原因是什么,和/或我如何防止它发生?
I'm running R via Rpy on a redhat linux distribution. Periodically I'll encounter this error message:
*** caught segfault ***
address (nil), cause 'unknown'
And the entire program dies right there. It usually occurs when I run a lot of regression r.lm()
. But by simply running the identical code again, the problem may or may not go away (so not always reproduceable). Does anyone know what might be causing this, and/or how I can prevent it from happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有几种可能性。
问题出在 R 代码上。要对此进行测试,请在 R 本身中运行代码,看看是否可以复制该问题。
问题出在 Rpy 上。在调试器中运行程序并查看从 Python 到 R 以及从 R 到 Python 到底传递了什么。据猜测,某种变量不匹配仅在某些条件下发生。
问题出在环境上。程序运行需要加载其他软件吗?是否曾经有效,然后再次运行时失败? (也许您没有关闭与文件的连接?)它在其他人的计算机上还是在您的计算机上失败?
问题出在数据上。你随机生成任何东西吗?这可以解释问题的间歇性。
如果您仍然遇到困难,请阅读一些调试技巧。
There are a few possibilities.
The problem is with the R code. To test this, run the code in R itself and see if you can replicate the issue.
The problem is with Rpy. Run the program in a debugger and see what exactly you are passing from Python to R and from R to Python. At a guess, you have some kind of variable mismatch that only occurs under some conditions.
The problem is with the environment. Does some other software need to be loaded for the progam to run? Does it work once then fail when you run it again? (Perhaps you aren't closing a connection to a file?) Does it fail on other people's machines or just yours?
The problem is with the data. Are you randomly generating anything? That would explain the intermittent nature of the problem.
If you're still stuck, read some tips on debugging.