ContinuumIO / topik

A Topic Modeling toolbox
BSD 3-Clause "New" or "Revised" License
92 stars 24 forks source link

Error in `/home/usr/anaconda2/bin/python': free(): invalid pointer: #71

Closed kenyeung128 closed 8 years ago

kenyeung128 commented 8 years ago

Hi, I installed topik 0.3.0 on ubuntu 15.0, however, I got this error when running topik. Anyone has idea why and how to fix it?

Error in `/home/usr/anaconda2/bin/python': free(): invalid pointer:

Thanks

msarahan commented 8 years ago

Hi, could you give us more information? Most helpful would be example code that reproduces this error.

kenyeung128 commented 8 years ago

it's a fresh installation of ubuntu, and I type "conda install -c memex topik" to install topik.

When I just typed topik as command in the bash, which gives me this error.

this is the exact error.

* Error in `/home/ken/anaconda2/bin/python': free(): invalid pointer: 0x00007fb2dfb39ec0 * Aborted (core dumped)

brittainhard commented 8 years ago

@kenyeung128 Tried recreating this in ubuntu 14.04 and got no such error when running topik without arguments. Is there any more information you can give is?

kenyeung128 commented 8 years ago

@brittainhard I think this error could be specific to the latest ubuntu 15.10, it uses g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010

this free(): invalid pointer looks like something in gcc/g++? or what information could I provide if it helps? I uses anaconda 64bit with python 2.7

msarahan commented 8 years ago

Yikes, that's a much bigger problem. GCC 5.2 is by default binary incompatible with GCC 4, which is what all of Anaconda is built for. We have discussed the impending nature of this issue, but this is the first issue report that I know of. This will take some time for us to figure out, and then carry out rebuilds necessary.

You might be able to get away with installing libgcc from conda. This will include a GCC 4-compatible libstdc++ that conda packages might find before they find the system one. This is something of a hail-mary guess, though.

If libgcc does not work for you, the way forward for you is to either fulfill topik's requirements from Ubuntu's package repository instead of Anaconda's (basically, use the system Python, but this may raise Python 3 compatibility issues), or to build everything from source. The recipes in conda-build should have most or all of topik's prerequisites. If any are missing, please let me know.

Ping @insertinterestingnamehere @groutr @ilanschnell @csoja - this is the tip of the iceberg that we have discussed regarding GCC 5.2 binary incompatibility

kenyeung128 commented 8 years ago

thanks. I have now switched to ubuntu v. 14 and it works just fine with topik.

msarahan commented 8 years ago

Great, glad to hear that, and glad to hear that was an option for you. We will be tackling this issue soon, since the next Ubuntu LTS release will have this new compiler as well.

scopatz commented 8 years ago

For what it is worth, I think I just hit this issue on Ubuntu 15.10 with a project I am trying to cythonize and gcc & libgcc from conda (v4.8.5). Any hints or suggestions?

msarahan commented 8 years ago

Sorry, we haven't. Work stopped on Topik quite a while back, and I haven't seen this in any other projects. @mingwandroid may have opinions here, but I don't think we can offer any quick fix.

scopatz commented 8 years ago

No worries @msarahan! I did end up figuring my issue out after posting this. It turned out Cython has the following weird behaviour:

cdef void* ptx = new MyClass()

# this will fail to cython-compile (since it is not a C++ object, to cython)
del ptx

# this will cause the free error above
free(ptx)

# This is a parser error in cython
del (<MyClass*> ptx)

# But this compiles and runs without issue:
cdef MyClass* cpp_ptx = <MyClass*> ptx
del cpp_ptx

Hopefully this helps someone....