Problems with installing statsmodels on Ubuntu

1,081 views
Skip to first unread message

George Panterov

unread,
Jul 12, 2012, 7:47:57 PM7/12/12
to pystat...@googlegroups.com
Hi everyone,

I had to re-install statsmodels and encountered a few problems which I wanted to share (I am with the latest version of Ubuntu). If I try installing it with easy_install and this is what I get:
sudo easy_install statsmodels
.....
  File "setup.py", line 196, in <module>
  File "setup.py", line 50, in check_dependency_versions
ImportError: statsmodels requires pandas

However, I already have pandas:
gpanterov@G-Computer:~$ sudo easy_install pandas
Searching for pandas
Best match: pandas 0.8.0
Processing pandas-0.8.0-py2.7-linux-i686.egg
pandas 0.8.0 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages/pandas-0.8.0-py2.7-linux-i686.egg
Processing dependencies for pandas
Finished processing dependencies for pandas


When I tried building it from source
sudo python setup.py build
sudo python setup.py install

The installation goes through (albeit with errors) but when I try
import statasmodels.api as sm

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/statsmodels/api.py", line 1, in <module>
    import iolib, datasets, tools
ImportError: No module named iolib

I was wondering if anyone had any suggestions.
Thanks
G

Yaroslav Halchenko

unread,
Jul 12, 2012, 9:42:58 PM7/12/12
to pystat...@googlegroups.com
FWIW
you can simply apt-get install python-statsmodels python-pandas
from http://neuro.debian.net/

Cheers
--
Yaroslav O. Halchenko
Postdoctoral Fellow, Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik

George Panterov

unread,
Jul 13, 2012, 9:33:20 AM7/13/12
to pystat...@googlegroups.com
Installation goes through but still no statsmodels.api ...

import statsmodels

In [2]: statsmodels.
statsmodels.NoseWrapper     statsmodels.test
statsmodels.Tester          statsmodels.with_statement
statsmodels.errstate    

In [2]: import statsmodels.api
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/gpanterov/<ipython-input-2-b81506c9f24a> in <module>()
----> 1 import statsmodels.api

/usr/local/lib/python2.7/dist-packages/statsmodels/api.py in <module>()
----> 1 import iolib, datasets, tools
      2 from tools.tools import add_constant, categorical
      3 import regression
      4 from .regression.linear_model import OLS, GLS, WLS, GLSAR
      5 from .genmod.generalized_linear_model import GLM

ImportError: No module named iolib


Skipper Seabold

unread,
Jul 13, 2012, 9:50:47 AM7/13/12
to pystat...@googlegroups.com
On Thu, Jul 12, 2012 at 7:47 PM, George Panterov
<econgp...@gmail.com> wrote:
> Hi everyone,
>
> I had to re-install statsmodels and encountered a few problems which I
> wanted to share (I am with the latest version of Ubuntu). If I try
> installing it with easy_install and this is what I get:
> sudo easy_install statsmodels
> .....
> File "setup.py", line 196, in <module>
> File "setup.py", line 50, in check_dependency_versions
> ImportError: statsmodels requires pandas
>
> However, I already have pandas:
> gpanterov@G-Computer:~$ sudo easy_install pandas
> Searching for pandas
> Best match: pandas 0.8.0
> Processing pandas-0.8.0-py2.7-linux-i686.egg
> pandas 0.8.0 is already the active version in easy-install.pth
>

Odd, I see this too trying to easy install from pypi, but presumably
you want to be installing from source for development anyway.

> Using
> /usr/local/lib/python2.7/dist-packages/pandas-0.8.0-py2.7-linux-i686.egg
> Processing dependencies for pandas
> Finished processing dependencies for pandas
>
>
> When I tried building it from source
> sudo python setup.py build

It shouldn't matter, but don't sudo the build step. If it complains
about permissions in your source folder then, you'll have to remove
those files from the build folder, etc. by hand.

> sudo python setup.py install
>
> The installation goes through (albeit with errors) but when I try
> import statasmodels.api as sm
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/local/lib/python2.7/dist-packages/statsmodels/api.py", line 1,
> in <module>
> import iolib, datasets, tools
> ImportError: No module named iolib
>
> I was wondering if anyone had any suggestions.
> Thanks
> G

I've never seen this. Can you send me the output of the build and
install log or put it on pastie.org.

In some folder, where you don't have work you want to lose do

git clean -xdfn

If that looks like you won't lose anything critical, then

git clean -xdf

then

python setup.py build &> build.log
sudo python setup.py install &> install.log

Skipper

Yaroslav Halchenko

unread,
Jul 13, 2012, 9:53:25 AM7/13/12
to pystat...@googlegroups.com


On Fri, 13 Jul 2012, George Panterov wrote:

> Installation goes through but still no statsmodels.api ...
> import statsmodels
> In [2]: statsmodels.
> statsmodels.NoseWrapper     statsmodels.test
> statsmodels.Tester          statsmodels.with_statement
> statsmodels.errstate    
> In [2]: import statsmodels.api
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call
> last)
> /home/gpanterov/<ipython-input-2-b81506c9f24a> in <module>()
> ----> 1 import statsmodels.api
> /usr/local/lib/python2.7/dist-packages/statsmodels/api.py in <module>()
> ----> 1 import iolib, datasets, tools
>       2 from tools.tools import add_constant, categorical
>       3 import regression
>       4 from .regression.linear_model import OLS, GLS, WLS, GLSAR
>       5 from .genmod.generalized_linear_model import GLM
> ImportError: No module named iolib

well -- you are still importing from /usr/local -- first remove this
incorrectly installed copy of statsmodels (and pandas)... and then your
packaged installation should work just fine... e.g. here I tried to
replicate/see if there is indeed any issue:

head2:/# nd_login nd+ubuntu precise amd64 /tmp/
-> Copying COW directory
forking: rm -rf /backup/neurodebian/build/cow.30733
forking: cp -al /backup/neurodebian/cow/nd+ubuntu-precise-amd64.cow /backup/neurodebian/build/cow.30733
I: removed stale ilistfile /backup/neurodebian/build/cow.30733/.ilist
-> Invoking pbuilder
forking: pbuilder login --aptcache /backup/neurodebian/ubuntu_aptcache --bindmounts /tmp/ --buildplace /backup/neurodebian/build/cow.30733 --no-targz --internal-chrootexec chroot /backup/neurodebian/build/cow.30733 cow-shell
W: /root/.pbuilderrc does not exist
I: Running in no-targz mode
I: copying local configuration
I: mounting /proc filesystem
I: mounting /dev/pts filesystem
I: Mounting /dev/shm
I: Mounting /tmp/
I: Mounting /var/cache/pbuilder/ccache
I: policy-rc.d already exists
I: Obtaining the cached apt archive contents
I: entering the shell
head2:/# apt-get install python-statsmodels
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libamd2.2.0 libblas3gf libexpat1 libgfortran3 liblapack3gf libumfpack5.4.0 mime-support neurodebian-popularity-contest popularity-contest python python-numpy python-scipy python-statsmodels-lib python-support python2.7
Suggested packages:
anacron python-doc python-tk python-numpy-doc python-numpy-dbg python-nose python-dev gfortran python-profiler python2.7-doc
Recommended packages:
file python-imaging python-pandas python-matplotlib python-joblib
The following NEW packages will be installed:
libamd2.2.0 libblas3gf libexpat1 libgfortran3 liblapack3gf libumfpack5.4.0 mime-support neurodebian-popularity-contest popularity-contest python python-numpy python-scipy python-statsmodels python-statsmodels-lib python-support python2.7
0 upgraded, 16 newly installed, 0 to remove and 0 not upgraded.
Need to get 3153 kB/20.8 MB of archives.
After this operation, 68.1 MB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://neuro.debian.net/debian/ precise/main python-statsmodels-lib amd64 0.4.2-1~nd12.04+1 [66.3 kB]
Get:2 http://neuro.debian.net/debian/ precise/main python-statsmodels all 0.4.2-1~nd12.04+1 [3087 kB]
Fetched 3153 kB in 0s (7395 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libexpat1.
(Reading database ... 13955 files and directories currently installed.)
Unpacking libexpat1 (from .../libexpat1_2.0.1-7.2ubuntu1_amd64.deb) ...
Selecting previously unselected package popularity-contest.
Unpacking popularity-contest (from .../popularity-contest_1.53ubuntu1_all.deb) ...
Selecting previously unselected package libgfortran3.
Unpacking libgfortran3 (from .../libgfortran3_4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package mime-support.
Unpacking mime-support (from .../mime-support_3.51-1ubuntu1_all.deb) ...
Selecting previously unselected package python2.7.
Unpacking python2.7 (from .../python2.7_2.7.3-0ubuntu3_amd64.deb) ...
Selecting previously unselected package python.
Unpacking python (from .../python_2.7.3-0ubuntu2_amd64.deb) ...
Selecting previously unselected package libamd2.2.0.
Unpacking libamd2.2.0 (from .../libamd2.2.0_1%3a3.4.0-2ubuntu3_amd64.deb) ...
Selecting previously unselected package libblas3gf.
Unpacking libblas3gf (from .../libblas3gf_1.2.20110419-2ubuntu1_amd64.deb) ...
Selecting previously unselected package liblapack3gf.
Unpacking liblapack3gf (from .../liblapack3gf_3.3.1-1_amd64.deb) ...
Selecting previously unselected package libumfpack5.4.0.
Unpacking libumfpack5.4.0 (from .../libumfpack5.4.0_1%3a3.4.0-2ubuntu3_amd64.deb) ...
Selecting previously unselected package neurodebian-popularity-contest.
Unpacking neurodebian-popularity-contest (from .../neurodebian-popularity-contest_0.27~nd11.10+1+nd12.04+1_all.deb) ...
Selecting previously unselected package python-numpy.
Unpacking python-numpy (from .../python-numpy_1%3a1.6.1-6ubuntu1_amd64.deb) ...
Selecting previously unselected package python-support.
Unpacking python-support (from .../python-support_1.0.14ubuntu2_all.deb) ...
Selecting previously unselected package python-scipy.
Unpacking python-scipy (from .../python-scipy_0.9.0+dfsg1-1ubuntu2_amd64.deb) ...
Selecting previously unselected package python-statsmodels-lib.
Unpacking python-statsmodels-lib (from .../python-statsmodels-lib_0.4.2-1~nd12.04+1_amd64.deb) ...
Selecting previously unselected package python-statsmodels.
Unpacking python-statsmodels (from .../python-statsmodels_0.4.2-1~nd12.04+1_all.deb) ...
Setting up libexpat1 (2.0.1-7.2ubuntu1) ...
Setting up popularity-contest (1.53ubuntu1) ...
Setting up libgfortran3 (4.6.3-1ubuntu5) ...
Setting up mime-support (3.51-1ubuntu1) ...
update-alternatives: using /usr/bin/see to provide /usr/bin/view (view) in auto mode.
Setting up python2.7 (2.7.3-0ubuntu3) ...
Setting up python (2.7.3-0ubuntu2) ...
Setting up libamd2.2.0 (1:3.4.0-2ubuntu3) ...
Setting up libblas3gf (1.2.20110419-2ubuntu1) ...
update-alternatives: using /usr/lib/libblas/libblas.so.3gf to provide /usr/lib/libblas.so.3gf (libblas.so.3gf) in auto mode.
Setting up liblapack3gf (3.3.1-1) ...
update-alternatives: using /usr/lib/lapack/liblapack.so.3gf to provide /usr/lib/liblapack.so.3gf (liblapack.so.3gf) in auto mode.
Setting up libumfpack5.4.0 (1:3.4.0-2ubuntu3) ...
Setting up neurodebian-popularity-contest (0.27~nd11.10+1+nd12.04+1) ...
Adding NeuroDebian url for Popularity Contest submissions.
Setting up python-numpy (1:1.6.1-6ubuntu1) ...
Setting up python-support (1.0.14ubuntu2) ...
Setting up python-scipy (0.9.0+dfsg1-1ubuntu2) ...
Setting up python-statsmodels-lib (0.4.2-1~nd12.04+1) ...
Setting up python-statsmodels (0.4.2-1~nd12.04+1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for python-support ...
head2:/# python -c 'import statsmodels.api'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/statsmodels/api.py", line 1, in <module>
import iolib, datasets, tools
File "/usr/lib/pymodules/python2.7/statsmodels/datasets/__init__.py", line 5, in <module>
import anes96, committee, ccard, copper, cpunish, elnino, grunfeld, longley, \
File "/usr/lib/pymodules/python2.7/statsmodels/datasets/anes96/__init__.py", line 1, in <module>
from data import *
File "/usr/lib/pymodules/python2.7/statsmodels/datasets/anes96/data.py", line 87, in <module>
import statsmodels.tools.datautils as du
File "/usr/lib/pymodules/python2.7/statsmodels/tools/__init__.py", line 1, in <module>
from tools import add_constant, categorical
File "/usr/lib/pymodules/python2.7/statsmodels/tools/tools.py", line 14, in <module>
from pandas import DataFrame
ImportError: No module named pandas
head2:/# apt-get install python-pandas
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
python-dateutil python-pandas-lib
Suggested packages:
python-pandas-doc
Recommended packages:
python-matplotlib python-tables python-tz python-xlrd python-openpyxl python-xlwt
The following NEW packages will be installed:
python-dateutil python-pandas python-pandas-lib
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1537 kB/1591 kB of archives.
After this operation, 5596 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://neuro.debian.net/debian/ precise/main python-pandas-lib amd64 0.8.0-1~nd12.04+1 [928 kB]
Get:2 http://neuro.debian.net/debian/ precise/main python-pandas all 0.8.0-1~nd12.04+1 [609 kB]
Fetched 1537 kB in 0s (6699 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package python-dateutil.
(Reading database ... 18194 files and directories currently installed.)
Unpacking python-dateutil (from .../python-dateutil_1.5-1_all.deb) ...
Selecting previously unselected package python-pandas-lib.
Unpacking python-pandas-lib (from .../python-pandas-lib_0.8.0-1~nd12.04+1_amd64.deb) ...
Selecting previously unselected package python-pandas.
Unpacking python-pandas (from .../python-pandas_0.8.0-1~nd12.04+1_all.deb) ...
Setting up python-dateutil (1.5-1) ...
Setting up python-pandas-lib (0.8.0-1~nd12.04+1) ...
Setting up python-pandas (0.8.0-1~nd12.04+1) ...
Processing triggers for python-support ...
head2:/# python -c 'import statsmodels.api'
head2:/#

George Panterov

unread,
Jul 13, 2012, 2:07:29 PM7/13/12
to pystat...@googlegroups.com
Here is the output I get when installing from source

Ralf Gommers

unread,
Jul 13, 2012, 3:04:35 PM7/13/12
to pystat...@googlegroups.com
On Fri, Jul 13, 2012 at 8:07 PM, George Panterov <econgp...@gmail.com> wrote:
Here is the output I get when installing from source


That's not the complete output.

Ralf


Skipper Seabold

unread,
Jul 15, 2012, 3:19:25 PM7/15/12
to pystat...@googlegroups.com
On Fri, Jul 13, 2012 at 3:04 PM, Ralf Gommers
<ralf.g...@googlemail.com> wrote:
>
>
> On Fri, Jul 13, 2012 at 8:07 PM, George Panterov <econgp...@gmail.com>
> wrote:
>>
>> Here is the output I get when installing from source
>>
>> http://pastie.org/4251266
>
>
> That's not the complete output.
>

George, did you figure this out ...?
Reply all
Reply to author
Forward
0 new messages