Search code examples
pythondebuggingnumpyanacondastatsmodels

Sudden crashing and error on previously working python statsmodels code


I've been running a class that I've coded for classification for the past several days without problems, when all of a sudden Anaconda's Spyder crashed and needed to restart. Now, on the same code that wasn't previously causing problems, I'm getting the following error:

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)

This error pops up when the program gets to this line of code:

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

Previously above I've done import statsmodels.api as sm

I really don't know what's wrong. After the error, I get a dialog box asking if I want to close the program or debug it. When I choose debug, it says

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

Does anyone have any idea of what to do here, or what could have gone wrong? And how and where in my code can I add casting="unsafe", according to the error.


Solution

  • Basically, after the initial crash, I'd forgotten which Anaconda/Spyder/Python version to run, so I was running the 32-bit version on my 64-bit machine.

    When I switched back to the 64-bit version, everything was normal again.