I want to use a flann-based matcher in Python as described in http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_feature2d/py_matcher/py_matcher.html
If you're on a Mac and using python3, this did it for me instead of building it from github:
brew install opencv3 --with-python3 --with-contrib
and
export PYTHONPATH=$PYTHONPATH:/usr/local/Cellar/opencv3/3.0.0/lib/python3.4/site-packages
replace python3.4 with your version.
Seems like there's some general problem with the function allocate(). I also had the same problem with BackgroundSubtractorMOG2, beside the FLANN matcher. This fixed both.