catboost: Unable to import _catboost when installed from wheel / py36 / new conda env
With a freshly created empty conda environment with numpy and six preinstalled (Linux / Python 3.6 / catboost 0.6.3):
$ conda install -y numpy
The following NEW packages will be INSTALLED:
mkl: 2017.0.3-0
numpy: 1.13.1-py36_0
Linking packages ...
$ pip install catboost
Collecting catboost
Using cached catboost-0.6.3-cp36-none-manylinux1_x86_64.whl
Requirement already satisfied: numpy in ./env/lib/python3.6/site-packages (from catboost)
Requirement already satisfied: six in ./env/lib/python3.6/site-packages (from catboost)
Installing collected packages: catboost
Successfully installed catboost-0.6.3
Now trying it out; looks like this one’s the actual problem:
>>> from catboost import _catboost
AttributeError: type object '_catboost._FloatArrayWrapper' has no attribute '__reduce_cython__'
And this is just a consequence of the extension module not being fully imported:
>>> from catboost import CatBoost
>>> CatBoost()
NameError Traceback (most recent call last)
./env/lib/python3.6/site-packages/catboost/core.py in __init__(self, params, model_file)
531 self._check_params(params)
532 params = self._params_type_cast(params)
>>> 533 super(CatBoost, self).__init__(params)
534 if model_file is not None:
535 self.load_model(model_file)
_catboost.pyx in _catboost._CatBoostBase.__init__()
_catboost.pyx in _catboost._CatBoostBase._check_train_params()
_catboost.pyx in _catboost._PreprocessParams.__init__()
NameError: name 'dumps' is not defined
Potentially related issues that I’ve managed to find, seems like it has to do with Cython / auto-pickling:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (4 by maintainers)
Commits related to this issue
- fix _catboost reinitialization issues #268 and #269 from github ref:a87d83370fda2ccdff0415df958bb6b8670ed046 — committed to catboost/catboost by kizill 6 years ago
I was trying to import catboost on Jupyterlab. In my code I have,
Then, I get AttributeError
It worked for me as well by rebooting jupyter.
So, i installed catboost by conda install, and after jupyter rebooting catboost can import.
I installed catboost and came across this error.
Got the same
@kizill Can confirm that with 0.8 the bug is apparently gone (testing it on the same environment as reported initially, Linux, 3.6), this issue should probably be closed.