I was trying to install the opencv with TBB in a new virtual environment. So I have two virtual environments and a base environment. Before this compiling, the base environment was working well, with my code (uses opencv, numpy, scipy, signal processing code running on video) ran fine. After installing opencv TBB, I get a segmentation fault running outside of the virtual environment (should be regular opencv installed) most of the time i run most of the python programs I have on the Raspberry Pi.

With gdb, the output I get when it segfaults is:

    (this=0x1bff000, number_of_bytes=<optimized out>,
    parent=0x63f015a0, context=0x647fd230) 
at ../../src/tbb/scheduler.cpp:315 315 my_free_list = t->prefix().next;

What is the reason for this? could this mean my python is corrupted?

1 Answer 1


You're in a very difficult situation. OpenCV is large and complicated. You're also dealing with TBB for, presumably performance optimization of OpenCV. The particular problem you're hitting is surprise at something that used to work fine. That's the Valley of Despair.

I deal with the Valley of Despair by creating scripts (bash or whatever you want) that re-create my desired work environment from a known configuration (e.g., Raspi install). With these scripts I can then restore any work environment as needed. These scripts are tedious to write but they take all the guesswork out of these nasty situations. You are now in a place where you want to restore the integrity of your base configuration. You can: a) hack until something works, or b) write yourself a script that gets you to a happy base configuration. The first choice is seductive and sometimes works. The second choice is a PIA--but it always gives you a good base configuration even if you have to wait hours.

I really hope someone out there can provide you a simpler more convenient answer, but if not, try scripting your way back to a happy base environment. I too have worked with OpenCv and shuddered through the Valley of Despair.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.