Search code examples
pythonflaskapache2catboost

import CatBoostClassifier takes too long for apache request


I am using Apache2 with WSGI to run my machine learning model with a Flask web service. My webserver has 2vCPU with 4GB RAM. At the moment where I include CatBoostClassifier with:

from catboost import CatBoostClassifier

The apache process loads endlessly. What I am doing wrong?

Edit: not only Catboost

 from sklearn.tree import DecisionTreeClassifier
 from sklearn.linear_model import LogisticRegression

are also not working.

The response looks endless and I don't see any error in the apache error logs.


Solution

  • This is a problem from mod_wsgi and the rights from some python packages, for example, scikit-learn. Here is a very old post for this:

    https://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API

    And to solve the problem you need to paste this

    WSGIApplicationGroup %{GLOBAL}