Why the Segmentation Fault! When I attempt to run / use Python Package gensim?
Question: Am attempting to use `[gensim][1]`, a Vector Space Modelling package for
python in some Machine Learning experiments of mine. I followed their
installation instructions as said
[here](http://nlp.fi.muni.cz/projekty/gensim/install.html), though
installation of `scipy` on my OpenSuse 11.3 failed when using `easy_install`
as they recommend, so I resorted to installing it from a package available on
the Official package search portal
[here](http://software.opensuse.org/search?q=scipy&baseproject=openSUSE:11.3&lang=en&exclude_debug=true).

Installation of `scipy` went ok, and then I used `easy_install` to install
`gensim` as they recommend. Which also went ok.

Now, after installation, I attempted to run the very first example they give
of using the package, which starts with a humble import statement as follows:

    
    
    from gensim import corpora, models, similarities
    

Lo! When I attempted to run that in my python interpreter, the dear thing
crashed with `Segmentation Fault`! This is what happened:

    
    
    >>> from gensim import corpora, models, similarities
    Segmentation fault
    

Someone save me, because I don't know where the error could possibly be coming
from.

I understand the segfault usually is due to illegal memory access by a
process, so could this be happening due to the import? or some error within
`gensim`?

For more info, it is said that after installing the package it can be tested,
so I did this to test my `gensim`, Lo! the same `Segmentation Fault`! Here is
the ouput:

    
    
    python setup.py test
    running test
    running egg_info
    writing requirements to gensim.egg-info/requires.txt
    writing gensim.egg-info/PKG-INFO
    writing top-level names to gensim.egg-info/top_level.txt
    writing dependency_links to gensim.egg-info/dependency_links.txt
    reading manifest file 'gensim.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching '*.sh' under directory '.'
    writing manifest file 'gensim.egg-info/SOURCES.txt'
    running build_ext
    Segmentation fault
    

For the dependent packages, I have:

    
    
    >>> numpy.version.version
    '1.3.0'
    
    >>> scipy.version.version
    '0.8.0'
    

Ok, as requested in the comments, I did hook gdb to the interpreter, and then
tried the import statement again, then this is what gdb gave when the segfault
occurred again:

    
    
    (gdb) continue
    Continuing.
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/time.so
    Try: zypper install -C "debuginfo(build-id)=da29868e88d517efc61eed319c4a87b41404f932"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/strop.so
    Try: zypper install -C "debuginfo(build-id)=1a5723f070198420ae565b728f267f00ae7e9885"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/cStringIO.so
    Try: zypper install -C "debuginfo(build-id)=d02dafc8dd403786b35ee44d946fc67461c7af34"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/_functools.so
    Try: zypper install -C "debuginfo(build-id)=4d3d7d73a2d7abe3d4ac45bdc07a070abde67a3b"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/_collections.so
    Try: zypper install -C "debuginfo(build-id)=86c7e2481ef3930f858927648d270a96ef65e0d9"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/operator.so
    Try: zypper install -C "debuginfo(build-id)=ecdf6c9dfbb007d3698e4108e2412b575b14c3f0"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/unicodedata.so
    Try: zypper install -C "debuginfo(build-id)=b84b2bd4061ce43b8fe6e7319d0e3fe90431f3f9"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/cPickle.so
    Try: zypper install -C "debuginfo(build-id)=0cb3d3c8e51cd264b7fc0cfd6ad6cea7da6173f1"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/itertools.so
    Try: zypper install -C "debuginfo(build-id)=88125d7ede2ef83a18e46901c9b7bd938d7554b9"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/_bisect.so
    Try: zypper install -C "debuginfo(build-id)=e872da9d2f7456947a21d6cf8ac05115da084ee0"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/_heapq.so
    Try: zypper install -C "debuginfo(build-id)=0c250b23be656b9984a8fbf67c232930141c6a79"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/math.so
    Try: zypper install -C "debuginfo(build-id)=48f975758f43cffc37703cda98615cb2daaf8a08"
    Missing separate debuginfo for /usr/lib/python2.6/site-packages/numpy/core/multiarray.so
    Try: zypper install -C "debuginfo(build-id)=adcbae28e6012eecb870c60af4805f25554c9148"
    Missing separate debuginfo for /usr/lib/python2.6/site-packages/numpy/core/umath.so
    Try: zypper install -C "debuginfo(build-id)=1087f0837567a96e6db9fadb8258f21113173f01"
    Missing separate debuginfo for /usr/lib/python2.6/site-packages/numpy/core/_sort.so
    Try: zypper install -C "debuginfo(build-id)=c70e9c08253546b727376f7643cc9b6cc796465e"
    Missing separate debuginfo for /usr/lib/python2.6/site-packages/numpy/core/scalarmath.so
    Try: zypper install -C "debuginfo(build-id)=cbc4ec89676c6072f64ae92a2917548479141eee"
    Missing separate debuginfo for /usr/lib/python2.6/site-packages/numpy/lib/_compiled_base.so
    Try: zypper install -C "debuginfo(build-id)=6f71bf761290527c07afe78736211d2393caa95e"
    Missing separate debuginfo for /usr/lib/python2.6/site-packages/numpy/linalg/lapack_lite.so
    Try: zypper install -C "debuginfo(build-id)=ac2cb74a8a055e3d58e15f4ac0012159abbf7d1a"
    Missing separate debuginfo for /usr/lib/liblapack.so.3
    Try: zypper install -C "debuginfo(build-id)=5c9cf054c3e366ea04681d3c3b1e4d1fa8b46da5"
    Missing separate debuginfo for /usr/lib/libblas.so.3
    Try: zypper install -C "debuginfo(build-id)=c7ea0a3cdf0da62f1f07f81838207e6070e86449"
    Missing separate debuginfo for /usr/lib/libgfortran.so.3
    Try: zypper install -C "debuginfo(build-id)=6889f5fdc16cb8d7cb4d5e97c59080336c2e6e01"
    Missing separate debuginfo for /lib/libgcc_s.so.1
    Try: zypper install -C "debuginfo(build-id)=ea12a9f70518dd6b807755150f1d2c6ba8550fe1"
    Missing separate debuginfo for /usr/lib/python2.6/site-packages/numpy/fft/fftpack_lite.so
    Try: zypper install -C "debuginfo(build-id)=32599ba87256834ebc65a962e4718aa1f9134b0e"
    Missing separate debuginfo for /usr/lib/python2.6/site-packages/numpy/random/mtrand.so
    Try: zypper install -C "debuginfo(build-id)=e43ddcab2e8e2961f3ab58087ac55dffa4094993"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/_ctypes.so
    Try: zypper install -C "debuginfo(build-id)=40cde5dd7ee47a3caac1ce1f94b6ef7fa28792ff"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/_struct.so
    Try: zypper install -C "debuginfo(build-id)=a5c456fe75e29e3424d7881fc05be8321fa65707"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/binascii.so
    Try: zypper install -C "debuginfo(build-id)=d3a2d6b38432a2b5076e238aef398cd3776bed20"
    Missing separate debuginfo for /lib/libz.so.1
    Try: zypper install -C "debuginfo(build-id)=afddd839a6c18dd308b04b5289c56cc3abd1384f"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/_random.so
    Try: zypper install -C "debuginfo(build-id)=683d2819c1613d54dcd68c9169fc043ecb1b5444"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/fcntl.so
    Try: zypper install -C "debuginfo(build-id)=aaabeb0dbb01b7a14698fd221d09fedc6de19521"
    Missing separate debuginfo for /usr/lib/libjpeg.so.8
    Try: zypper install -C "debuginfo(build-id)=5656b9563c388beee6e716dbe832ecb4480895ba"
    Missing separate debuginfo for /usr/lib/python2.6/lib-dynload/array.so
    Try: zypper install -C "debuginfo(build-id)=4e4aea1f2106d4a7a7b4dbd51199e337549b83e2"
    Missing separate debuginfo for /usr/lib/libstdc++.so.6
    Try: zypper install -C "debuginfo(build-id)=181385b3f6f58b2e13543468f07e08c5edd2cd86"
    
    Program received signal SIGSEGV, Segmentation fault.
    0x00000000 in ?? ()
    


Answer: You are probably trying to run a 64-bit binary (or use a 64-bit library) on a
32-bit system.

Use `python -v` when you run the task that produces the segmentation fault to
see if you can pinpoint where it is. If this isn't clear enough, then try
`strace python` instead of just `python`. If the segmentation fault appears
just after an attempt to "open" a .so file, then use a tool like `file` or
`readelf` to find out how many bits the binary or .so library requires.

If you have a 686 Linux then everything must be 32 bits. If you have an x86_64
Linux then it should all be 64 bits.

