【问题标题】:Sudden crashing and error on previously working python statsmodels code以前工作的 python statsmodels 代码突然崩溃和错误
【发布时间】:2014-06-26 20:08:05
【问题描述】:

在过去的几天里,我一直在运行一个我为分类编写的类,但突然间 Anaconda 的 Spyder 崩溃并需要重新启动。 现在,在以前没有引起问题的相同代码上,我收到以下错误:

C:\Users\app\anacondasoftware\lib\site-packages\numpy\linalg\linalg.py:1327: 
DeprecationWarning: Implicitly casting between incompatible kinds. In a future 
numpy release, this will raise an error. Use casting="unsafe" if this is 
intentional.
  u, s, vt = gufunc(a, signature=signature, extobj=extobj)

程序到了这行代码就弹出这个错误:

    temp_g = sm.WLS(y1, self.X, w).fit()

之前我已经完成了import statsmodels.api as sm

我真的不知道怎么了。出错后,我得到一个对话框,询问我是否要关闭程序或调试它。当我选择调试时,它说

Unhandled exception at 0x1e0ee4fc in python.exe: 0xC0000005: Access violation writing location 0x00000000.

有没有人知道在这里做什么,或者可能出了什么问题?以及如何以及在我的代码中的何处添加casting="unsafe",根据错误。

【问题讨论】:

  • 我猜你的数据中有一些“奇怪”的东西。你的 numpy 和 scipy 版本是什么?是 y1 还是 self.X 还是 w 对象数组? wexog 中有 nans 或 infs 吗?我见过的唯一段错误是使用 numpy 的一个旧版本,在日期时间段上使用 numpy.linalg。将其移至 statsmodels 问题跟踪器github.com/statsmodels/statsmodels/issues 可能会更好。
  • 没有数据和旧的一样。我意识到出了什么问题 - 我使用的是 32 位版本而不是 64 位版本。
  • 这并不能解释为什么 32 位版本会崩溃。 32 位版本也不应该崩溃。

标签: python debugging numpy anaconda statsmodels


【解决方案1】:

基本上,在最初的崩溃之后,我忘记了要运行哪个 Anaconda/Spyder/Python 版本,所以我在我的 64 位机器上运行 32 位版本。

当我切换回 64 位版本时,一切又恢复正常了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-07
    • 2016-07-14
    • 1970-01-01
    • 2021-07-28
    • 1970-01-01
    相关资源
    最近更新 更多