Python: Erratic joblib behaviour on Flask Python: Erratic joblib behaviour on Flask flask flask

Python: Erratic joblib behaviour on Flask


I was stuck with this for quite sometime. Posting the answer in case someone runs into this problem. Using print statements and looking at logs I narrowed the problem down to joblib.load statement. I found this awesome blog: http://blog.rtwilson.com/how-to-fix-flask-wsgi-webapp-hanging-when-importing-a-module-such-as-numpy-or-matplotlib

The idea of using a global process group fixed the problem. That forced the use of main interpreter just as the top comment on that blog page mentions.