pythonpython-3.xcatboost

Problem with importing `catboost` package


I was trying to install catboost, and everything was going well until I decided to upgrade to Python 3.12. After the upgrade, I encountered an error when I tried to import it:

numpy.dtype size changed, may indicate binary incompatibility. 
Expected 96 from C header, got 88 from PyObject

I attempted various approaches and even downgraded to a previous version, but the issue persisted. I then reverted to Python 3.11 and installed the package again, but I still encountered the same error. Additionally, I installed Numpy with the latest version.
I hope anyone helps because I feel like I'm selling the laptop soon.


Solution

  • Problem is with numpy 2.0

    Currently, catboost does not support numpy 2.0: https://github.com/catboost/catboost/issues/2671

    You need to do:

    pip install numpy==1.26.4