ImportError: No module named statsmodels.api

229 views
Skip to first unread message

Albert Zhuang

unread,
Mar 10, 2017, 10:14:54 AM3/10/17
to pystatsmodels
Hello all,

after I cloned the resource from github: https://github.com/statsmodels/statsmodels.git
I run 
python setup.py install
python setup.py install
Then when I try to import 

 import statsmodels.api as sm 

 I get the following error 

>>> import statsmodels.api as sm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "statsmodels/api.py", line 7, in <module>
    from .regression.recursive_ls import RecursiveLS
  File "statsmodels/regression/recursive_ls.py", line 16, in <module>
    from statsmodels.tsa.statespace.mlemodel import (
  File "statsmodels/tsa/statespace/mlemodel.py", line 15, in <module>
    from .simulation_smoother import SimulationSmoother
  File "statsmodels/tsa/statespace/simulation_smoother.py", line 10, in <module>
    from .kalman_smoother import KalmanSmoother
  File "statsmodels/tsa/statespace/kalman_smoother.py", line 11, in <module>
    from statsmodels.tsa.statespace.representation import OptionWrapper
  File "statsmodels/tsa/statespace/representation.py", line 10, in <module>
    from .tools import (
  File "statsmodels/tsa/statespace/tools.py", line 209, in <module>
    set_mode(compatibility=None)
  File "statsmodels/tsa/statespace/tools.py", line 61, in set_mode
    from . import (_representation, _kalman_filter, _kalman_smoother,
ImportError: cannot import name _representation

How can I fix this?

josef...@gmail.com

unread,
Mar 10, 2017, 10:35:11 AM3/10/17
to pystatsmodels
I guess it did not compile the cython code correctly.
Check for error messages in `python setup.py install` or try `python
setup.py build_ext` before install and check whether build_ext
completes without error.

Josef
Reply all
Reply to author
Forward
0 new messages