Re: [pystatsmodels] Trouble Installing

35 views
Skip to first unread message

Skipper Seabold

unread,
May 9, 2013, 7:33:05 PM5/9/13
to pystat...@googlegroups.com
On Thu, May 9, 2013 at 7:30 PM, Beth <tech...@gmail.com> wrote:
> Hi, I'm new to statsmodels (but not to Python), and I'm having a hard time
> installing the module. I'm working on Ubuntu Server 12.10 with no access to
> the internet (but it does have access to a local repository), so I can't use
> pip or easy_install.
>
> I installed the package 'python-scikits.statsmodels', and it seemed like it
> installed successfully. But when I tried "import statsmodels" or "import
> statsmodels.api", I get:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named statsmodels
>
> I also downloaded the source, uninstalled the Ubuntu package, and tried
> installing it that way with the same result. I have seen other Google
> answers for this problem, but they usually involve multiple python versions
> - there is only one version of python on this computer, Python 2.7.3.
>
> Are there any things I could check or other things I could try? Keep in mind
> this computer has no direct access to the internet.
>

This ubuntu package is very old. The import for this would be

import scikits.statsmodels as sm

HOWEVER, I *highly* recommend obtaining a newer version of the source
from github and installing it. Then your import will work as you
tried.

https://github.com/statsmodels/statsmodels
http://statsmodels.sourceforge.net/devel/install.html

Skipper

Beth

unread,
May 10, 2013, 5:36:16 PM5/10/13
to pystat...@googlegroups.com
Ok, thanks, that import works.

Just as a note though - I mentioned in my post that I also tried installing from source - the source I used was the newest one from Github, transferred via USB.  This also did not work with the import statement above - maybe I have the name wrong for that as well. 

Skipper Seabold

unread,
May 10, 2013, 5:39:36 PM5/10/13
to pystat...@googlegroups.com
On Fri, May 10, 2013 at 5:36 PM, Beth <tech...@gmail.com> wrote:
> Ok, thanks, that import works.
>

I *really* don't recommend using this old version though.

> Just as a note though - I mentioned in my post that I also tried installing
> from source - the source I used was the newest one from Github, transferred
> via USB. This also did not work with the import statement above - maybe I
> have the name wrong for that as well.

This should work fine. Can you post the exact commands you use to
install from source, the build log, and the error message?

Skipper

Beth

unread,
May 10, 2013, 6:17:37 PM5/10/13
to pystat...@googlegroups.com
I understand, I would rather not use the old version, it's just the only one working at the moment.

To install from source, I ran "python setup.py install" and nothing else.
Here's a pastebin of the output (since there's a lot):

The error I get when trying to import in Python is the same as above:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named statsmodels

The dependencies were installed using the Ubuntu repo (numpy, scipy, etc.), maybe those are old as well?

Skipper Seabold

unread,
May 10, 2013, 6:35:17 PM5/10/13
to pystat...@googlegroups.com
On Fri, May 10, 2013 at 6:17 PM, Beth <tech...@gmail.com> wrote:
> I understand, I would rather not use the old version, it's just the only one
> working at the moment.
>
> To install from source, I ran "python setup.py install" and nothing else.
> Here's a pastebin of the output (since there's a lot):
> http://pastebin.com/9rUjsJhR
>
> The error I get when trying to import in Python is the same as above:
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named statsmodels
>

Hmm, nothing looks out of place.

You said you're there aren't two version of Python installed, so
that's kind of a mystery.

What does this say to be sure

python -c"import sys; print sys.version"

You might try this

Edit (with permissions) /usr/local/lib/python2.7/dist-packages/easy-intall.pth

and remove any lines that contain statsmodels (including scikits.statsmodels)

then remove

/usr/local/lib/python2.7/dist-packages/statsmodels*

And make sure there's no "scikits-statsmodels" anything in there. Then
in the statsmodels git repo do

git clean -xdf

You might again need sudo permissions to remove the build folder. Then
try to install again. Nothing looks out of place, as far as I can
tell. Just want to be sure this happens with a clean install.


> The dependencies were installed using the Ubuntu repo (numpy, scipy, etc.),
> maybe those are old as well?

Shouldn't be a problem. Wouldn't give an ImportError anyhow.

Beth

unread,
May 14, 2013, 9:46:06 PM5/14/13
to pystat...@googlegroups.com
The output of python -c "import sys; print sys.version" was:
2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3]

I ran through the steps you listed, and for whatever reason, it worked! I can import it just fine now. Not sure what got messed up, but thanks for the help. 
Reply all
Reply to author
Forward
0 new messages