import statsmodels.api --> segmentation fault

240 views
Skip to first unread message

ben

unread,
Jan 8, 2014, 10:34:58 AM1/8/14
to pystat...@googlegroups.com
hi guys/girls, my code can't pass through the following line:

import statsmodels.api


It would throw 'Segmentation fault' error. I would appreciate if anyone can point me to the right direction.. btw I'm using debian 64bit and 64 bit python. Importing statsmodels.api worked fine in one of my virtual environments before I messed it up and deleted it.. I'm not sure what's going on since I can import statsmodels just fine. If it would help I've listed some of my modules' versions below:


dateutil 2.1
matplotlib 1.3.1
numba 0.11.1
numpy 1.7.1
pandas 0.12.0
python 2.7.6
python-dateutil 1.5
scipy 0.13.2
statsmodels 0.5.0

josef...@gmail.com

unread,
Jan 8, 2014, 10:49:43 AM1/8/14
to pystatsmodels
statsmodels has currently only two extensions in c that could
segfault, but that's very unlikely.

You can try if your installed versions of our dependencies are ok.
numpy.test()
scipy.test()
pandas ? I don't know how the test suite of pandas is run, mabye using
nosetests directly.

These are the three packages that are imported. I think we also import
matplotlib with the import of statsmodels.api if available.

another possibility

import statsmodels
statsmodels.test(verbose=3)
and check where the segfault occurs.

Josef

Skipper Seabold

unread,
Jan 8, 2014, 11:04:02 AM1/8/14
to pystat...@googlegroups.com
Assuming you're on a posix system, you can use gdb to get some more
information. Something like the following should work

gdb --args python -c "import statsmodels.api as sm"

Then in gdb

run
backtrace

Skipper

ben

unread,
Jan 9, 2014, 7:11:29 AM1/9/14
to pystat...@googlegroups.com
Thanks for the pointers guys. I ran the line of code I was having trouble with inside my virtual environment (in Anaconda Continuum). I did some gdb debugging as advised and got this result:

(foo)ben@debi:~$ gdb --args python -c "import statsmodels.api as sm"
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ben/anaconda/envs/foo/bin/python...done.
(gdb) run
Starting program: /home/ben/anaconda/envs/foo/bin/python -c import\ statsmodels.api\ as\ sm
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6aae1a0 in PyArray_API ()
   from /home/ben/anaconda/envs/foo/lib/python2.7/site-packages/numpy/core/multiarray.so

I got some advise on Anaconda google group and it was mentioned that the fault lies with linalg as seen below:

ben@debi:~$ gdb --args python -c "import scipy.linalg as la; la.test()"
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ben/anaconda/bin/python.
..done.
(gdb) run
Starting program: /home/ben/anaconda/bin/python -c import\ scipy.linalg\ as\ la\;\ la.test\(\)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Running unit tests for scipy.linalg
NumPy version 1.7.1
NumPy is installed in /home/ben/anaconda/lib/python2.7/site-packages/numpy
SciPy version 0.13.2
SciPy is installed in /home/ben/anaconda/lib/python2.7/site-packages/scipy
Python version 2.7.6 |Anaconda 1.8.0 (64-bit)| (default, Nov 11 2013, 10:47:18) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)]
nose version 1.3.0
............................................................................0-th dimension must be fixed to 3 but got 15
..0-th dimension must be fixed to 3 but got 5
..................................K..............................................................................................................................................................................................................................................................................................K....................................................................................................................................................................
Program received signal SIGSEGV, Segmentation fault.
0x00007fffede7d3c8 in master.0.id_srand_ ()
   from /home/ben/anaconda/lib/python2.7/site-packages/scipy/linalg/_interpolative.so

..so i guess this fault did not come from statsmodels.api then?

Skipper Seabold

unread,
Jan 9, 2014, 7:42:08 AM1/9/14
to pystat...@googlegroups.com
No. It looks like there are problems with your numpy and scipy installations.

The Anaconda people should be able to help you reinstall.

Skipper

ben

unread,
Jan 9, 2014, 9:09:20 AM1/9/14
to pystat...@googlegroups.com
Thanks, appreciate the pointers!
Reply all
Reply to author
Forward
0 new messages