From 5d4c24a1fc68c7deceb977c80c32f45b43a8be11 Mon Sep 17 00:00:00 2001 From: Rory Mitchell Date: Wed, 22 Jan 2020 18:02:39 +1300 Subject: [PATCH] Fix cupy without cudf import (#5219) --- python-package/xgboost/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/xgboost/core.py b/python-package/xgboost/core.py index 065426fbd..a382de4eb 100644 --- a/python-package/xgboost/core.py +++ b/python-package/xgboost/core.py @@ -688,7 +688,7 @@ class DMatrix(object): """Set info type property into DMatrix.""" # If we are passed a dataframe, extract the series - if isinstance(data, CUDF_DataFrame): + if CUDF_INSTALLED and isinstance(data, CUDF_DataFrame): if len(data.columns) != 1: raise ValueError('Expecting meta-info to contain a single column') data = data[data.columns[0]]