AttributeError: module 'cupy' has no attribute 'ndarray'

I’m testing XGBoost with the following code (data loaded already):

import xgboost
from xgboost import XGBClassifier

model=XGBClassifier(n_estimators=1400,max_depth= 7,
                        learning_rate=0.001, subsample=0.1)

model.fit(X_train, y_train)

The second line of code model.fit(X_train, y_train) reports the following ERROR messages:

File ~/.local/lib/python3.8/site-packages/xgboost/core.py:506, in _deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
    504 for k, arg in zip(sig.parameters, args):
    505     kwargs[k] = arg
--> 506 return f(**kwargs)

File ~/.local/lib/python3.8/site-packages/xgboost/sklearn.py:1181, in XGBClassifier.fit(self, X, y, sample_weight, base_margin, eval_set, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, base_margin_eval_set, feature_weights, callbacks)
   1176     if (
   1177         self.classes_.shape != expected_classes.shape
   1178         or not (self.classes_ == expected_classes).all()
   1179     ):
   1180         raise ValueError(label_encoding_check_error)
-> 1181 elif _is_cupy_array(y):
   1182     import cupy as cp  # pylint: disable=E0401
   1184     self.classes_ = cp.unique(y)

File ~/.local/lib/python3.8/site-packages/xgboost/data.py:596, in _is_cupy_array(data)
    594 except ImportError:
    595     return False
--> 596 return isinstance(data, cupy.ndarray)

AttributeError: module 'cupy' has no attribute 'ndarray'

It looks to have some relationship with XGBoost, as well as copy’s function _is_cupy_array. Any suggestions please?