Theano – stack smashing error

Last updated on April 2nd, 2015

I’ve been working on getting my laptop‘s Nvidia GPU working with Theano on Ubuntu 14.04. The whole process of getting the GPU to work has been a quite a learning experience… (but more on that later)

After installing Anaconda (which includes Theano!), I start Python from the Terminal:

$ python

Python starts up correctly. I then try to import the theano library…

>>> import theano

and Ubuntu freezes up 🙁

So I restart the machine and try again to run Python and import Theano, but get the following error message:

$ python
>>> import theano
*** stack smashing detected ***: python terminated
Aborted (core dumped)

I’m suspecting something got corrupted when theano was compiling the GPU functions. A quick google-search returns a related hit where someone else also suspects the compiled temporary cuda-related files are corrupted, and the person wonders where the tmp files are stored. No fix is provided.

I believe the Theano compiled temp files are found under:

~/.theano/

So I navigate to (you might have a different folder name after ~./theano):

cd ~/.theano/compiledir_Linux-3.16.0-33-generic-x86_64-with-debian-jessie-sid-x86_64-2.7.9-64/

and with some slight nausea, blow all the files away in this folder…

$ rm * -r

Holding my breath, I start Python and try again to import Theano:

$ python
>>> import theano
Using gpu device 0: GeForce GTX 860M

Success! Yay 🙂