Reputation: 33
I have: statsmodels 0.5.0 (formally known as scikits.statsmodels) pandas 0.12.0. (all installed from source)
I get this error:
File "/home/username/.local/python27/lib/python2.7/site-packages/pandas-0.12.0-py2.7-linux-x86_64.egg/pandas/stats/ols.py", line 53, in __init__
import scikits.statsmodels.api as sm
ImportError: No module named scikits.statsmodels.api
Why is pandas still looking for scikits.statsmodels? Should I install an old version of scikits.statsmodels parallel to statsmodels 0.5.0?
Upvotes: 3
Views: 4534
Reputation: 797
So, I encountered this problem and the reason was statsmodels has a dependency on patsy.
try:
import statsmodels.api as sm
except ImportError:
import scikits.statsmodels.api as sm
When importing statsmodels, not having patsy also throws an ImportError. Running
easy_install patsy
was a fix for this. Not sure why, but pip installed statsmodels without realizing patsy was a dependency.
Upvotes: 1
Reputation: 9986
You are missing the right package.
Just run:
sudo pip install statsmodels
Upvotes: 3
Reputation: 46636
Version 0.12 first tries to import the statsmodels
library and only if it fails, pandas fall back to the scikits
module. Here is the piece of code that tries to do that:
try:
import statsmodels.api as sm
except ImportError:
import scikits.statsmodels.api as sm
If you type in the interpreter:
import statsmodels.api as sm
What error do you get?
Upvotes: 6