1

I'm running python 3.6 and have statsmodels installed in ./anaconda/lib/python3.6/site-packages however when I try to import statsmodels in python I get the error: "No module named 'statsmodels'". Can someone explain what I'm supposed to do?

I'm using Sublime Text's built in command line interface.

briancaffey
  • 2,125
  • 4
  • 24
  • 49

1 Answers1

1

The issue here is that Sublime Text's CLI and your terminal point to different versions of Python.

In your terminal the result of import sys; sys.executable is

/Users/username/anaconda/bin/python'

but in the Sublime Text CLI you would see:

/Library/Frameworks/Python.framework/Versions/3.6/bin/python‌​3

The Sublime Text CLI python path does not have the statsmodels package whereas the anaconda python does. It is possible to change the default python path in Sublime Text. See this question for more details on how to do that. I would recommend just running python from your terminal and not the sublime text CLI to keep things simple.

briancaffey
  • 2,125
  • 4
  • 24
  • 49